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
> >

Reply via email to