Thanks Alex, your help is much appreciated. However and as you may already know..I am a completely newbie in Xerces. So I have the big picture about what I have to do but I don't know how (class and methods' names and use). How can I create a new element to be written in a parsed XML file with the DOMWriter? With the writeNode method? How can I specify the file, the type of node (element or attribute) and the content itself? That means how can I change the DOM tree as been said before? And how to serialize it?
On the other side I know that using SAX I could override startElement and endElement methods in order to define what I want to do in the XML file parsing process but I don't know if this applies to DOM as well or (if not) which methods I must override or use. Sorry for the inconvenience created by my questions but I am trying to find the path to start with Xerces after searching for classes and methods in the api and finding nothing clear enough (probably because of my lack of knowledge on Xerces and these kind of tools). Any guide points, references, links or examples would be so much appreciated. Sorry again and thank you very much, Javi 2007/11/16, Axel Weiss <[EMAIL PROTECTED]>: > > On Thu, 2007-11-15 at 07:58 +0100, Javier Gálvez Guerrero wrote: > > Ok, sorry. > > > > I'm designing an IPTV client-server application that transports video on > > demand. The server has to manage with user profiles and an electronic > guide > > of contents. There is a XML file for the guide and one for each user. > > > > In the server side, what I need to do is this. Each time the admin > enters > > through a GUI the new parameters of a content I would like to add this > new > > content on the guide xml file. "Content" is an element in the "Contents' > > Guide" XML schema. Then I need to parse a C++ object (content) to a XML > > element (content, in content_guide XML file). Moreover, each time a new > user > > signs in the service, the server should create a new XML file for the > user, > > based on the XML schema for a user. > > Javier: > one way to edit xml files with xerces is > - read the existing xml file into a DOM representation, > - make your desired changes to the DOM tree, > - serialize the DOM tree to a file (which can have the original > filename). > > You can also create xml files (e.g. for your user) with the steps > - create a DOM tree (e.g. DOM_Document), > - populate it with some elements, > - serialize it to a file. > > You cannot validate your changes against a schema/DTD while it is > represented in DOM (which has never been intended by the standards). In > order to validate a DOM tree, you need to serialize it (e.g. into a > buffer) and re-parse. > > > HTH, > Axel > > > In conclusion, what I need is to know how can I parse from C++ objects > or > > attributes to an XML file in two cases: when I need to create a XML file > > based on an existing XML schema (user) and add a new element (content) > on an > > existing XML file (content_guide). I'm about to use Xerces C++ 2.8.0 for > > Windows but, in case this version didn't support the feature I need > there > > would be no problem to switch to any previous version. What I need is > some > > slight guiding points or whatever it could help (the API, a sample, a > > link...) to notice how can I do it as I haven't been able to find it by > > myself. > > > > I hope this helps. Thanks a lot, > > > > Javi > > > > > > > > 2007/11/15, David Bertoni <[EMAIL PROTECTED]>: > > > > > > Javier Gálvez Guerrero wrote: > > > > I suppose you refer to the zip pack it can be downloaded from the > > > Xerces' > > > > site. I had already looked for any XML file writing sample and in > the > > > > website as well but I didn't find anything. Are you referring to any > > > other > > > > thing? > > > > > > Part of the problem is your question is too vague to answer properly. > > > Xerces-C has functionality to serialize an instance of the DOM, but > how > > > it's done depends on what version of Xerces-C you're using. > > > > > > Please describe what you plan to do with Xerces-C, and someone will be > > > able > > > to help. > > > > > > Dave > > > > >
