Thank you all very much, specially to Sven who shared his own effort. However, I have looked into the samples on the repositories site and I can't find how to "extract" the data itself from the DOM tree. If you don't mind I would like to make some simple questions so with your answers I hope I could start typing code.
//get the DOM representation DOMNode *doc = parser->getDocument(); I can not find the getDocument method description in the provided documentation and I am quite confused about it. Anyway, *doc is supposed to be the DOM representation. So, what I need to do is to extract many elements (with their childs and attributes) from a XML file, which is supposed to be represented by *doc once it has been parsed and got. Then, how can I assign, let's say, the value of the "nickname" element inside its parent element "user"? getDocument returns the root node? So I guess I can ask it for its children and then "move" through the tree with methods of the DOMNode API, like for example, getNodeValue(), getChildNodes() and so on. Is it ok? Does it exist any other way to extract data from the DOM representation or this is the one about to use? Thank you all very much again and sorry for the inconvenience. I am really interested in using Xerces in the application I am developing, so that's whay I would like to know how to use it properly. Cheers, Javi ** 2007/11/27, David Bertoni <[EMAIL PROTECTED]>: > > Sven Bauhan wrote: > > Hi Javi, > > > > the Xerces interface is not really intuitively. A short description can > be > > found at the DOM programming giude: > > http://xerces.apache.org/xerces-c/program.html > > > > In the Xerces documentation it is often described to use an extra class > for > > the conversion of std::string and XMLChar*. I have written such a class. > As > > it is quite short, I attach it here. > Your class uses XMLString::transcode(), which transcodes to the local code > page. This will result in data loss in cases where content contains > Unicode characters that are not representable in the local code page. A > better choice would be to transcode to UTF-8, which is compatible with > char* APIs, and has the advantage that it can represent any Unicode > character. > > There are many postings in the archives that will illustrate why using > XMLString::transcode() is a bad idea. I wish we would actually modify the > analogous class in our samples so it doesn't do local code page > transcoding, as it's providing a bad example. > > Dave >
