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 Paulo David Oliveira <pa...@optimus.pt> on 2002/10/07 10:09:04 UTC

DOM Writer

Hello,

  I'm writing a DOMDocument in memory with DOMWriter and then calling writeNode to a file. In the xml file just created the dtd file does not appear, in other words "SYSTEM "exp.dtd" is missing. The document type is created like this:

        DOMDocumentType* type = impl->createDocumentType(X("company"),X(""),X("exp.dtd"));

        DOMDocument* doc = impl->createDocument(
                    0,                    // root element namespace URI.
                    X("company"),         // root element name
                    type);


The final XML:

<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>

<!DOCTYPE company>

<company><product>Xerces-C</product><category name="0">XML Parsing Tools</category><category name="Paulo" name1="Oliveira">Experiencia<Qualquer>Nome</Qualquer></category><category name="2">XML Parsing Tools</category><category name="3">XML Parsing Tools</category><category name="4">XML Parsing Tools</category><developedBy>Apache Software Foundation</developedBy></company>

The final XML expected:

<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>

<!DOCTYPE company SYSTEM "exp.dtd">

<company><product>Xerces-C</product><category name="0">XML Parsing Tools</category><category name="Paulo" name1="Oliveira">Experiencia<Qualquer>Nome</Qualquer></category><category name="2">XML Parsing Tools</category><category name="3">XML Parsing Tools</category><category name="4">XML Parsing Tools</category><developedBy>Apache Software Foundation</developedBy></company>


What is missing?



Thank you!

---------------------------------------------------------------------
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 Writer

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
	I added the type to the creation of the document in the sample 
CreateDOMDocument and wrote it to the file before the counting part. This 
produced the XML you were expecting. Have a go at that and if it does not 
work then post your code.

Gareth



On Mon, 7 Oct 2002, Paulo David Oliveira wrote:

> 
> Hello,
> 
>   I'm writing a DOMDocument in memory with DOMWriter and then calling writeNode to a file. In the xml file just created the dtd file does not appear, in other words "SYSTEM "exp.dtd" is missing. The document type is created like this:
> 
>         DOMDocumentType* type = impl->createDocumentType(X("company"),X(""),X("exp.dtd"));
> 
>         DOMDocument* doc = impl->createDocument(
>                     0,                    // root element namespace URI.
>                     X("company"),         // root element name
>                     type);
> 
> 
> The final XML:
> 
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
> 
> <!DOCTYPE company>
> 
> <company><product>Xerces-C</product><category name="0">XML Parsing Tools</category><category name="Paulo" name1="Oliveira">Experiencia<Qualquer>Nome</Qualquer></category><category name="2">XML Parsing Tools</category><category name="3">XML Parsing Tools</category><category name="4">XML Parsing Tools</category><developedBy>Apache Software Foundation</developedBy></company>
> 
> The final XML expected:
> 
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
> 
> <!DOCTYPE company SYSTEM "exp.dtd">
> 
> <company><product>Xerces-C</product><category name="0">XML Parsing Tools</category><category name="Paulo" name1="Oliveira">Experiencia<Qualquer>Nome</Qualquer></category><category name="2">XML Parsing Tools</category><category name="3">XML Parsing Tools</category><category name="4">XML Parsing Tools</category><developedBy>Apache Software Foundation</developedBy></company>
> 
> 
> What is missing?
> 
> 
> 
> Thank you!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 

-- 
Gareth Reakes, Head of Product Development  
DecisionSoft Ltd.            http://www.decisionsoft.com
Office: +44 (0) 1865 203192



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org