tinyxml & C++

This is a discussion on tinyxml & C++ within the C++ Programming forums, part of the General Programming Boards category; I have been reading for hours and hours now and have got absolutley nowhere! ...my C programming skills are more ...

  1. #1
    Matt Conway bobthebullet990's Avatar
    Join Date
    Nov 2005
    Location
    Cambridge
    Posts
    121

    tinyxml & C++

    I have been reading for hours and hours now and have got absolutley nowhere! ...my C programming skills are more than adequate, but I don't really know much C++ structure, I have done plenty of Java so understand OO!

    I want to parse an XML document containing data and be able to manipulate / display the data from the XML document, there are no fancy GUI's, just a command prompt! ...I have downloaded Tiny XML, ran and read the test program supplied, but really don't have a clue how I would open an XML file for parsing as the XML file they have supplied is just a pointer to a char array containing chars rather than opening an XML file!

    does anyone have any simple code that will simply open the XML file and store the contents of the file into memory?

    here is my XML file...
    Code:
    <codes>
    <airport code="HNL" name="Honolulu"/>
    <airport code="JFK" name="New York"/>
    <airport code="LAX" name="Los Angeles"/>
    <airport code="LGW" name="London Gatwick"/>
    <airport code="LHR" name="London Heathrow"/>
    <airport code="MIA" name="Miami"/>
    <airport code="OKL" name="Orlando"/>
    <airport code="SFO" name="San Fransisco"/>
    </codes>
    basically, I need some sort of data structure that i can use to hold the airport names and codes!

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I would say someone whose "C programming skills are more than adequate" should be able to do that. Post what you've done so far.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Matt Conway bobthebullet990's Avatar
    Join Date
    Nov 2005
    Location
    Cambridge
    Posts
    121
    Sorry, have not got anywhere!!! ...we have to use tinyxml or qt, i was told tinyxml was a bit simpler to use, however, I really don't understand this at all!!! dont have a clue where to start; nor do any of my fellow students! ...no help from useless lecturers doesn't help at all!!!

    ...In C programming; I have written a simple device driver, a linux shell which incorporates cd, pwd, ls, ps & kill. Also various image processing functions for PPM and PGM image files; blur, sharpen, color to greyscale, greyscale to b & w, contrasting, brightness variation, solarisation, embossing.

    My problem here is, my lecturer is rubbish, and just don't know where to start!
    Last edited by bobthebullet990; 05-04-2006 at 12:03 PM.

  4. #4
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    you know OO from java, right? well start by figuring out your design. I'll give you a hint: in general, when writing code to read from xml, every differenct xml element is an object. xml attributes are members of that object. Where elements are composed of other elements your class design should reflect this. So start by giving me a rough outline of the two obvious classes from your xml and I'll help you from there.

    edit: and if C++ syntax is confusing you, write the classes in java and try to port it.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. TinyXML - copy subtrees
    By pixsta in forum C++ Programming
    Replies: 1
    Last Post: 01-30-2006, 02:23 PM
  2. Win32 API & XML question
    By Born_2B_Alone in forum Windows Programming
    Replies: 8
    Last Post: 09-23-2004, 04:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21