Re: XML Manipulation
"Nick MacDonald" <[email protected]>
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
Note that eXpat is a SAX parser, which means it does not load the entire XML document into memory, and you basically get to see the document in one pass. If you need to have the whole document in memory for your processing, you'll probably want to look into another type of XML processor, such as a DOM based one that loads the whole XML document into memory, and provides the means to "walk" through it in memory. Assuming you can get by with the SAX limitations, there is some sample code included with the eXpat package, but there will probably not be enough there to get you near the finish line. You will need to write a bit of a state machine to track the incoming XML so that you know when you have found the things you're looking for. You'll probably also need to use a stack data structure to know the "path" at any given time as you are parsing your file. Some day someone should write a sample program to translate an XML file and include it with the basic eXpat package as an example... if such a thing were to be done that would be exactly where you'd want to start. Good luck, Nick On 3/15/06, Srinivas Cheruku <[email protected]> wrote: > I understand that expat is used for XML Parsing. > > I need to manipulate the XML data read from a xml file by changing certain node values. > Can i use expat for this type of XML manipulation? > If so, can anyone direct me to the sample code for XML manipulation?