>From the snippet below, I do not see that you are writing anything to output.

Raymond

From: Kok How, Teh [mailto:[email protected]]
Sent: Wednesday, March 09, 2011 3:54 AM
To: [email protected]
Subject: EXTERNAL: writing XML declaration into XML file

Hi;
            I am using xerces-3.1.1 and I have the following code snippet:


              XMLString::transcode("LS", name, 99);
              DOMImplementation *impl = 
DOMImplementationRegistry::getDOMImplementation(name);
              DOMLSSerializer* theSerializer = 
((DOMImplementationLS*)impl)->createLSSerializer();

              if 
(theSerializer->getDomConfig()->canSetParameter(XMLUni::fgDOMNamespaceDeclarations,true))
                     
theSerializer->getDomConfig()->setParameter(XMLUni::fgDOMNamespaceDeclarations,true);

              if 
(theSerializer->getDomConfig()->canSetParameter(XMLUni::fgDOMXMLDeclaration,true))
                     
theSerializer->getDomConfig()->setParameter(XMLUni::fgDOMXMLDeclaration,true);


              DOMImplementation* impl = 
DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("core"));
              XMLCh* buffer = new XMLCh[length +1];
              XMLString::transcode( name, buffer, length );
              m_domDoc = impl->createDocument(0, buffer, 0);
              m_domDoc->setXmlVersion(XMLString::transcode("1.1"));
              m_domDoc->setXmlStandalone(false);
              m_docRoot = m_domDoc->getDocumentElement();

I thought I will have the usual XML declaration (<?xml version="1.1" 
encoding="utf-8"?) as the first line of the XML output file but unfortunately, 
it's not there. Any insight is appreciated. Thanks.

Regards,
KH

Notice: This e-mail is intended solely for use of the individual or entity to 
which it is

addressed and may contain information that is proprietary, privileged, company 
confidential

and/or exempt from disclosure under applicable law. If the reader is not the 
intended

recipient or agent responsible for delivering the message to the intended 
recipient, you are

hereby notified that any dissemination, distribution or copying of this 
communication is

strictly prohibited. If this communication has been transmitted from a U.S. 
location it may

also contain data subject to the International Traffic in Arms Regulations or 
U.S. Export

Administration Regulations and cannot be disseminated, distributed or copied to 
foreign

nationals, residing in the U.S. or abroad, without the prior approval of the 
U.S. Department

of State or appropriate export licensing authority. If you have received this 
communication

in error, please notify the sender by reply e-mail or collect telephone call 
and delete or

destroy all copies of this e-mail message, any physical copies made of this 
e-mail message

and/or any file attachment(s).


Reply via email to