Sudha Sathiaseelan wrote:

Hi all,

Is there a known way to ignore whitespace when loading an xml document through DocumentBuilderFactoryImpl?

Set DocumentBuilderFactory#setIgnoringElementContentWhitespace(boolean) to true. You should note that this feature works only when element content is made avaliable to the parser. making it mandatory for DOCTYPE declaration to be part of XML document.

http://java.sun.com/webservices/docs/1.1/api/javax/xml/parsers/DocumentBuilderFactory.html
http://www.w3.org/TR/REC-xml#sec-white-space

Neeraj



For those familiar with .NET/C#, it's possible to toggle the PreserveWhitespace 
flag on an XmlDocument.  I can't seem to find a corollary with the xerces 
parser.  Any suggestions (besides  formatting the input xml document on one 
line)

Thanks,
Sudha

i.e.

<?xml version="1.0"?><books 
price="6"><book><author>Carson</author></book></books>

as opposed to

<?xml version="1.0"?>
<books price="6">
   <book>
        <author>Carson</author>
        <price format="dollar">31.95</price>
        <pubdate>05/01/2001</pubdate>
   </book>
 </books>

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



Reply via email to