You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by 丁辉 <dh...@bisp.com> on 2001/03/13 03:57:49 UTC

How to save Document Type Declaration to a XML file?

I wrote a program to read a XML file and then write back to disk ,but i find that the processing instruction and the Document type definiton were missing in the output file.how can i write them to the xml file using Xerces?Tnanks.

Re: How to save Document Type Declaration to a XML file?

Posted by 丁辉 <dh...@bisp.com>.
An example:
The input XML file:
<?xml version="1.0" standalone="no?>                    
<?xml-stylesheet type="text/xsl" href="aa.xsl"?>
<!DOCTYPE  AA [
    <!ELEMENT AA ANY>
    <!ELEMENT BB ANY>
]>
<AA>
    .....
    <BB>.....</BB>
</AA>

The output file:
<?xml version="1.0" standalone="no?>                    
<AA>
    .....
    <BB>.....</BB>
</AA>
Note that the processing instruction and the internal DTD set were missing in the output file.
----- Original Message ----- 
From: "Arnaud Le Hors" <le...@us.ibm.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, March 14, 2001 10:41 AM
Subject: Re: How to save Document Type Declaration to a XML file?


> "ä¸è¾" wrote:
> > 
> > but i can not serialize the processing instruction and DTD declaration to that file.
> 
> I don't have the answer to your question unfortunately but the XML
> declaration is NOT a processing instruction. Even though it looks like
> one.
> -- 
> Arnaud  Le Hors - IBM Cupertino, XML Strategy Group
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 

Re: How to save Document Type Declaration to a XML file?

Posted by Arnaud Le Hors <le...@us.ibm.com>.
"ä¸è¾" wrote:
> 
> but i can not serialize the processing instruction and DTD declaration to that file.

I don't have the answer to your question unfortunately but the XML
declaration is NOT a processing instruction. Even though it looks like
one.
-- 
Arnaud  Le Hors - IBM Cupertino, XML Strategy Group

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


Re: How to save Document Type Declaration to a XML file?

Posted by 丁辉 <dh...@bisp.com>.
but i can not serialize the processing instruction and DTD declaration to that file.
----- Original Message ----- 
From: "René Jensen" <lu...@tbkol.dk>
To: <xe...@xml.apache.org>
Sent: Tuesday, March 13, 2001 6:27 PM
Subject: Re: How to save Document Type Declaration to a XML file?


> Citat ¶¡»Ô <dh...@bisp.com>:
> 
> > I wrote a program to read a XML file and then write back to disk ,but i
> > find that the processing instruction and the Document type definiton
> > were missing in the output file.how can i write them to the xml file
> > using Xerces?Tnanks.
> > 
> 
> If you use the DOMparser to parse you xml-document, you can then use 
> XMLSerializer to serialize the DOM-tree to a file.
> 
>        _\|/_
>        (@ @)
> ---oOOo-(_)-oOOo---
>     René Jensen
>  lundeman@tbkol.dk
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 

Re: How to save Document Type Declaration to a XML file?

Posted by René Jensen <lu...@tbkol.dk>.
Citat ¶¡»Ô <dh...@bisp.com>:

> I wrote a program to read a XML file and then write back to disk ,but i
> find that the processing instruction and the Document type definiton
> were missing in the output file.how can i write them to the xml file
> using Xerces?Tnanks.
> 

If you use the DOMparser to parse you xml-document, you can then use 
XMLSerializer to serialize the DOM-tree to a file.

       _\|/_
       (@ @)
---oOOo-(_)-oOOo---
    René Jensen
 lundeman@tbkol.dk

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