You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Robert Eberhardt <pr...@yahoo.de> on 2001/10/11 14:26:57 UTC
DOM_DOcument::createXMLDecl()
Hello,
I try to use the following code inorder to create a
DOM_Document that has a XML Decl unfortunatly it
does'not work mybe somebody can tell me what is wrong
DOM_DOMImplementation impl;
DOM_DocumentType Type =
impl.createDocumentType("Type","","example.dtd");
DOM_Document
doc=impl.createDocument(0,"Firma",Type);
DOM_XMLDecl Decl =
doc.createXMLDecl("1.0","UTF-8","no");
//doc.appendChild(Decl);
DOM_Element rootElement = doc.getDocumentElement();
DOM_Element abteilung =
doc.createElement("Abteilung");
rootElement.appendChild(abteilung);
bye Robert
__________________________________________________________________
Es ist soweit: das Nokia Game beginnt. Sei bereit für das multimediale Abenteuer. Melde dich bis zum 3. November bei http://de.promotions.yahoo.com/info/nokiagame an!
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: DOM_DOcument::createXMLDecl()
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Robert Eberhardt" <pr...@yahoo.de> writes:
> Hello,
>
> I try to use the following code inorder to create a
> DOM_Document that has a XML Decl unfortunatly it
> does'not work mybe somebody can tell me what is wrong
>
> DOM_DOMImplementation impl;
> DOM_DocumentType Type =
> impl.createDocumentType("Type","","example.dtd");
> DOM_Document
> doc=impl.createDocument(0,"Firma",Type);
> DOM_XMLDecl Decl =
> doc.createXMLDecl("1.0","UTF-8","no");
> //doc.appendChild(Decl);
> DOM_Element rootElement = doc.getDocumentElement();
> DOM_Element abteilung =
> doc.createElement("Abteilung");
> rootElement.appendChild(abteilung);
Hey Robert,
The document you created with createDocument() already has a node, the
doctype node. The XMLDecl node has to be first, so you need to use
doc.insertBefore(Decl,Type);
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org