You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Sereena <se...@mindtree.com> on 2006/04/24 16:13:12 UTC

Help regarding xml parsing Required

We parse an xml, convert it to a document perform some operations on the same 
and later convert them to bytes. In doing so we find some undesired differences 
in the input and output xml. 

For E.g.

Input xml 

<?xml version="1.0"  encoding="UTF-8"  ?>

<Trial><Font  fcolor="White" ff="Arial"></Font> </Trial>
 

We parse using

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

DocumentBuilder db = dbf.newDocumentBuilder();

db.parse(...)

 

This document we directly convert back to bytes using TransformerFactory. But 
output comes like this:- 

Output xml
 

<?xml version="1.0"  encoding="UTF-8"  ?>

<Trial><Font  fcolor="White" ff="Arial"/></Trial>
 

Though the output xml is right in xml terms it is not okay for our application 
as the tool which reads this output xml requires </Font> tag mentioned 
explicitly . Is there any parameter, property setting that will enable us to 
get the </Font> tag. Our application is coded in Java.





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


Re: Help regarding xml parsing Required

Posted by Joseph Kesselman <ke...@us.ibm.com>.
>Is there any parameter, property setting that will enable
us to
> get the </Font> tag.

One possibility is to use the xsl:output directive in your stylesheet to
request HTML output. Of course that has other effects; most obviously, the
output will be HTML rather than XHTML.

______________________________________
"... Three things are most perilous: Connectors that corrode,
  Unproven algorithms, and self-modifying code! ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish
(http://www.ovff.org/pegasus/songs/threes-rev-11.html)


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


Re: Help regarding xml parsing Required

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Sereena <se...@mindtree.com> wrote on 04/24/2006 10:13:12 AM:

<snip/>

> This document we directly convert back to bytes using 
TransformerFactory. But 
> output comes like this:- 
> 
> Output xml
> 
> 
> <?xml version="1.0"  encoding="UTF-8"  ?>
> 
> <Trial><Font  fcolor="White" ff="Arial"/></Trial>
> 
> 
> Though the output xml is right in xml terms it is not okay for our 
> application 
> as the tool which reads this output xml requires </Font> tag mentioned 
> explicitly . Is there any parameter, property setting that will enable 
us to 
> get the </Font> tag. Our application is coded in Java.

Xerces doesn't implement TransformerFactory so if such a property exists 
(and I doubt it does) you'd be looking for it in Xalan or some other XSLT 
processor.

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

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org


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