Tristan Mehamli wrote: > Hi, > I want to create a DOM tree in order to generate an XML file with > DOMWriter. > > This is the an example of the document I want to generate: > <?xml version="1.0" Encoding="UTF-8" ?> > <!-- A comment--> > <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation="myschema.xsd"> > <tag1> > <tag2>its value</tag2> > <tag3 atName="value" atName="value"></tag3> > <tag4> > <tag5> > <tag6>its value</tag6> > </tag5> > </tag4> > </tag1> > </root> > > Can someone give me an example of code to generate a DOM tree that > describes this document?
Hi Tristan, you first generate an empty document with DOMImplementation::createDocument(). Subsequently you fill the root element with children, according to your needs. Finally, you write out the result DOMDocument with DOMWriter::writeToString(). Read the docs! http://xml.apache.org/xerces-c/apiDocs/index.html is a good starting point. > Is there a way to generate a DOM tree from an XML schema and just fill > its nodes? No. Hope it helps, Axel -- Humboldt-Universit�t zu Berlin Institut f�r Informatik Signalverarbeitung und Mustererkennung Dipl.-Inf. Axel Wei� Rudower Chaussee 25 12489 Berlin-Adlershof +49-30-2093-3050 ** www.freesp.de **
