Hi Alberto, Could you please help me out and look into the issue?
Regards Gaurav Sharma ________________________________ From: Sharma, Gaurav Sent: Monday, May 23, 2011 1:30 PM To: 'c-users@xerces.apache.org' Subject: RE: Regarding xml declaration Hi Alberto, Below is the code that create and write the dom tree to the file. //creation xercesc::DOMImplementation* impl = xercesc::DOMImplementationRegistry::getDOMImplementation("core") ; xercesc::DOMDocument *doc = impl->createDocument(0, "root", 0); doc->setXmlVersion(XMLString::transcode("1.0")); //writing to a file void ClgnDomHelper::write_dom(const xercesc::DOMDocument* doc, const oef_char_t* out_file_name) { xercesc::DOMImplementation *impl = xercesc::DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("LS")); xercesc::DOMLSSerializer *writer = static_cast<xercesc::DOMImplementationLS*>(impl)->createLSSerializer(); writer->getDomConfig()->setParameter(XMLString::transcode("format-pretty-print"), true); if (writer->getDomConfig()->canSetParameter(xercesc::XMLUni::fgDOMXMLDeclaration, true)) { writer->getDomConfig()->setParameter(xercesc::XMLUni::fgDOMXMLDeclaration,true); } if (out_file_name != NULL) { xercesc::DOMLSOutput *output = static_cast<xercesc::DOMImplementationLS*>(impl)->createLSOutput(); xercesc::LocalFileFormatTarget my_form_target(out_file_name); output->setByteStream(&my_form_target); writer->write(doc, output); output->release(); } writer->release(); } Regards Gaurav Sharma -----Original Message----- From: Alberto Massari [mailto:alberto.mass...@progress.com] Sent: Monday, May 23, 2011 1:19 PM To: c-users@xerces.apache.org Subject: Re: Regarding xml declaration The XML declaration string is added when serializing the document; can you tell us how you are doing it? Alberto Il 23/05/2011 09:22, Sharma, Gaurav ha scritto: > Hi All, > > Can anyone of you please tell me that how to specify the xml declaration in > the output xml document. I create document using > > xercesc::DOMImplementation* impl = > xercesc::DOMImplementationRegistry::getDOMImplementation("core") ; > xercesc::DOMDocument *doc = impl->createDocument(0, "root", 0); > > But the xml declaration string "<?xml version="1.0" encoding="utf-8"?>" > doesn't appear at the top. > > Please help! > > Thanks and Regards > Gaurav Sharma > > > > The information contained in this electronic mail transmission > may be privileged and confidential, and therefore, protected > from disclosure. If you have received this communication in > error, please notify us immediately by replying to this > message and deleting it from your computer without copying > or disclosing it. > > > The information contained in this electronic mail transmission may be privileged and confidential, and therefore, protected from disclosure. If you have received this communication in error, please notify us immediately by replying to this message and deleting it from your computer without copying or disclosing it.