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...
basically, I need some sort of data structure that i can use to hold the airport names and 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"/>
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.
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!
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.