Hi, I don't seem to understand why it would be necessary for a DTD to be specified (and validated) for DocumentBuilderFactory#setIgnoringElementContentWhitespace(boolean) to work correctly. For example, if a user did not want the factory to ignore whitespaces (because he/she was parsing a poem xml file), then they simply would set the boolean to false. What does the DTD verification have to do with anything? Maybe I should be sending this to the developer list?
Thanks, Sudha -----Original Message----- From: Neeraj Bajaj [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 10:09 PM To: [EMAIL PROTECTED] Subject: Re: Whitespaces 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]