Here is the code i use
m_Doc = m_Impl.createDocument(0, "Scanner" , DOM_DocumentType());
DOM_XMLDecl
domDecl = m_Doc.createXMLDecl("1.0", "iso-8859-1" , "yes" );
m_RootElement =
m_Doc.getDocumentElement();
DOM_Node child ;
m_RootElement.insertBefore(domDecl,child);
as a result I get :
<Scanner>
<?xml version="1.0"
encoding="iso-8859-1" standalone="yes"?>
</Scanner>
I failed with all my efforts to insert the XMLDecl at the begginig.
Any help ?
> ----------
> From: Jesse Pelton
> Reply To: [EMAIL PROTECTED]
> Sent: Wednesday, July 25, 2001 3:32 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: DOMPrint: Declaration and Document Type
>
> You need to use DOM_Document::createXMLDecl() to create a non-null
> XMLDecl:
>
> DOM_XMLDecl domDecl = m_Doc.createXMLDecl ("1.0", // XML version
> "UTF-8", // encoding
> ""); // standalone flag
>
> Note that this is a Xerces extension to the DOM, experimental and subject
> to
> change.
>
> Also, I think you'll want to use getDocumentElement() as I recommended,
> not
> getFirstChild().
>
> -----Original Message-----
> From: Chaim Koshizky [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 25, 2001 5:35 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: DOMPrint: Declaration and Document Type
>
>
> I tried creating DOM_XMLDecl and insert before.
>
> It does not work the way you describe.
> here is the code :
>
> DOM_XMLDecl domDecl; // It
> creates a null Dec
> DOM_Node child = m_Doc.getFirstChild();
> m_RootElement.insertBefore(&domDecl,child);
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]