|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Simple XML parser needed (Page 2)
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#11 (permalink) | |
|
Case Modder
![]() |
From the tinyXML doc:
Quote:
__________________
Rich Custom Wooden Case Builder
|
|
|
|
|
|
|
#12 (permalink) | ||||||||||||||
|
Overclocker
![]()
Join Date: Apr 2008
Location: Toronto, Ontario
Posts: 1,587
Rep: 142
![]() ![]() Unique Rep: 118
Trader Rating: 0
|
Most of the XML parsers seems to be much more complex then I need it to be, is there something that would allow me to point to a value and read it in one line of code?
I figured out how to use an ini parser in minutes but I don't know enough to understand XML parsers... This is what I had for ini files Quote:
I don't know a lot right now and this is just confusing me.
__________________
DD-WRT Firmware Club|Top Gear Fan Club|Microsoft Windows Club|Mozilla FirefoxClub| A MEMBER OF THE RAZER CU|T
Last edited by Darkknight512 : 07-13-09 at 04:41 PM |
||||||||||||||
|
|
|
|
|
#13 (permalink) | |||||||||||||
|
Overclocker
![]()
Join Date: Apr 2008
Location: Toronto, Ontario
Posts: 1,587
Rep: 142
![]() ![]() Unique Rep: 118
Trader Rating: 0
|
Anyone?
__________________
DD-WRT Firmware Club|Top Gear Fan Club|Microsoft Windows Club|Mozilla FirefoxClub| A MEMBER OF THE RAZER CU|T
|
|||||||||||||
|
|
|
|
|
#14 (permalink) | |||||||||||||
|
NEEDZ MOAR PPD
![]() |
from BeatifulSoup load BeautifulStoneSoup as BS
this is python, don't know what language you're working in here... basically, use BS to parse through the XML file, it may be a bit confusing, but its very powerful, and can do alot of things... then you can print out to files as needed... and store loacally and just have it overwrite or catenate to the files each time it loads?
__________________
I am 91% addicted to Counterstrike. What about you? OCN CS:S GG: overclock.nuclearfallout.net:27015 OCN TF2: 68.232.173.130:27015 BRAND NEW 500FPS!!! My Role in this community is to make your gaming experience on our gameservers enjoyable
please feel free to PM me with your suggestions and issues.
|
|||||||||||||
|
|
|
|
#15 (permalink) | |||||||||||||
|
Overclocker
|
Hi Darkknight,
I strongly recommend if your going to be parsing XML data using TinyXML, i've used it for countless games i've made its probably the best libary out there for c++ and there is a non stl version which is awesome if your console programing. Code:
<Level name="levelname">
<monster>
<monster name="" type="" hp="" x="" y""/>
<monster name="" type="" hp="" x="" y""/>
<monster name="" type="" hp="" x="" y""/>
<monster name="" type="" hp="" x="" y""/>
</monster>
<item>
<item name="" x="" y"">
</item>
</Level>
__________________
Macbook|2ghz|2gigRam|Dvd Burn|MacOSX 10.4.10 1.1v
|
|||||||||||||
|
|
|
|
|
#16 (permalink) | |||||||||||||
|
Overclocker
|
oh forgot here is a some code on how to use tinyxml if your stuck
keep in mind this is off the top of my head Code:
TiXmlDocument *xmlDoc; //this will hold your file that needs to be past
TiXmlElement *xmlRoot, *xmlNodes; //xml file structure
xmlDoc = new TiXmlDocument(); //dynamicly create a object of TIXMLDocument on the heap
xmlDoc->Parse(/*File*/);
xmlNodes = xmlRoot->FirstChildElement("monster");
if(xmlNodes) // read into the file
{
TiXmlElement *xmlMonster, *xmlItem;
std::string monsterName = xmlNode->Attribute("name");
std::string type = xmlNode->Attribute("type");
Vector2 tempV;
tempV.x = xmlNode->Attribute("x");
tempV/y = xmlNode->Attribute("y");
}
delete xmlDoc; //Clean up the object off the heap, "close the file"
__________________
Macbook|2ghz|2gigRam|Dvd Burn|MacOSX 10.4.10 1.1v
|
|||||||||||||
|
|
|
|
|
#17 (permalink) | |||||||||||||
|
Overclocker
![]()
Join Date: Apr 2008
Location: Toronto, Ontario
Posts: 1,587
Rep: 142
![]() ![]() Unique Rep: 118
Trader Rating: 0
|
Thank's I'll look into that when I got some free time, been a little busy the past week.
__________________
DD-WRT Firmware Club|Top Gear Fan Club|Microsoft Windows Club|Mozilla FirefoxClub| A MEMBER OF THE RAZER CU|T
|
|||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|