You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Corbett, Keith" <km...@netgen.com> on 2000/12/01 20:18:25 UTC

RE: Write a DOM document created to a XML file.....

Suggestion: define a class to encapsulate parser and/or formatter settings.
For example:

 DOM_Document myDocument;
 DOM_DocIO myDocIO(myDocument);

 // Set parser options
 myDocIO.setValidationScheme(DOMParser::Val_Auto);
 // Read document from stdin
 cin >> myDocIO;

 // Set formatter options
 myDocIO.setOutputEncoding("UTF-16");
 // Write document to stdout
 cout << myDocIO;

/kmc

> -----Original Message-----
> From: Dave Viner [mailto:dviner@yahoo-inc.com]
> Sent: Thursday, November 30, 2000 2:00 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: Write a DOM document created to a XML file.....
> 
> 
> A super nice-to-have feature that would prob. ease life for 
> most people
> would be somthing like this:
> 
> DOM_Document doc = parser.getDocument();
> .. do stuff to the doc ..
> cout<<doc<<endl;
> 
> It seems like the only thing the << operator would assume is a default
> encoding (UTF-8, seems fine)
> then just iterate thru the tree and print everything out
> 
> or maybe it would be more flexible to do
> 
> doc.toString()
> 
> then all string goodness comes along for the ride...
> 
> Is there already code beyond the DOMPrint that will do that?  If not,
> i'd like to propose that as a suggestion for serializing development,
> esp. since sensible default are what the apache group is known for.
> 
> dave
> 
> 
> Khaled Noaman wrote:
> > 
> > Andy is currently working on a XML Serializer, and this 
> feature is not yet
> > availabe in xerces-c. Take a look at the DOMPrint sample 
> for an example on
> > parsing  XML file
> > then writing it out back to the screen. You can use that code.
> > 
> > Regards,
> > Khaled Noaman
> > XML Parser Dev. - IBM Toronto Lab
> > knoaman@ca.ibm.com
> > 
> > "Lahiri, Mitun" wrote:
> > 
> > > Hi,
> > > I have created a DOM document and would like to write it 
> out to a disk file
> > > as a XML document. Are there any classes in Xerces-C that 
> support this
> > > requirement?
> > >
> > > I saw a New Feature Request List that had a request - 
> "XML Serializer. Write
> > > out a DOM tree in memory as XML"
> > > Has this feature been added to Xerces-C - if so, which 
> version has it?
> > > I would appreciate any help on this matter.
> > >
> > > Thanks
> > > Mitun
> > >
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> -- 
> Strategury
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>