Hello everybody,
i tried the DocumentBuilder example from the samples of Xalan-C.
Now my DocumentBuilder holds my XML document and i don't know how to write this document to a file for testing purposes.
Can anybody help me please?
Thanks in advance.
Cheers
Pete
1) Create a new save FileFormatTarget
std::auto_ptr<XMLFormatTarget> FileTarget(new LocalFileFormatTarget("C:\\Temp\\Test.xml"));
2) Get the Serializer from the Implementation
m_impl = DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("LS"));
... DOMWriter* theSerializer = m_impl->createDOMWriter();
3) Write the whole Document to the File
DOMDocument* m_doc; m_doc = m_impl->createDocument(...);
... theSerializer->writeNode(FileTarget.get(), *m_doc)
4) Don't forget to catch any possible exceptions!
;-) AnR
