HI!
Hmm, adding the following line to my code did not produce a DOM without those
whitespaces:
dbf.setAttribute("http://apache.org/xml/features/dom/include-ignorable-whitespace",
new Boolean(false));
Is there a reason for this?
Thanks!
Regards,
Thomas
> -----Original Message-----
> From: Julian Reschke [mailto:[EMAIL PROTECTED]
> Sent: Montag, 4. M�rz 2002 13:58
> To: [EMAIL PROTECTED]
> Subject: RE: Bad bug in handling of extra spaces
>
>
> That's because MSXML (wrongly) defaults to a mode where it removes
> "ignorable" whitespace.
>
> > -----Original Message-----
> > From: Thomas B�rkel [mailto:[EMAIL PROTECTED]
> > Sent: Monday, March 04, 2002 1:56 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: Bad bug in handling of extra spaces
> >
> >
> > HI!
> >
> > Thanks for the ultrafast answer. :-)
> >
> > We are currently switching our application from MX XML 4.0 (used
> > via a COM bridge) to Xerces2.
> >
> > So, I suppose, the bug is in MS XML then, because there are no
> > extra text nodes.
> >
> > This is the MS XML code:
> > msXmlDoc = new FreeThreadedDOMDocument();
> > msXmlDoc.loadXML(xml);
> >
> > System.out.println(msXmlDoc.getDocumentElement().getChildNodes().g
> > etItem(0).getXml());
> >
> > Are you sure that the Xerces behavior is the correct one? Hmm, I
> > think, I remember a switch for Xerces about some whitespaces.
> > Otherwise this would probably break some code of us.
> >
> > Thanks!
> >
> > Regards,
> > Thomas
> >
> > > -----Original Message-----
> > > From: Julian Reschke [mailto:[EMAIL PROTECTED]
> > > Sent: Montag, 4. M�rz 2002 13:41
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: Bad bug in handling of extra spaces
> > >
> > >
> > > It isn't a bug at all.
> > >
> > > "formatting spaces" are whitespace and thus are reported as
> > > text nodes.
> > >
> > > > -----Original Message-----
> > > > From: Thomas B�rkel [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, March 04, 2002 1:38 PM
> > > > To: Xerces Mailinglist
> > > > Subject: Bad bug in handling of extra spaces
> > > >
> > > >
> > > > HI!
> > > >
> > > > Xerces (tested with current build) handles formatting spaces as
> > > > elements of type text.
> > > >
> > > > Example 1:
> > > > xml = "<root>\r\n <p0><![CDATA[abc]]></p0>\r\n
> > > > <p1><![CDATA[xyz]]></p1>\r\n</root>";
> > > >
> > > > Example 2:
> > > > xml =
> > > "<root><p0><![CDATA[abc]]></p0><p1><![CDATA[xyz]]></p1></root>";
> > > >
> > > > The 2 examples produce 2 different DOMs! The first one produces
> > > > an incorrect DOM.
> > > >
> > > >
> > > > You can test it with this code:
> > > > Document doc;
> > > > DocumentBuilderFactory dbf;
> > > > DocumentBuilder db;
> > > >
> > > > dbf = DocumentBuilderFactory.newInstance();
> > > > dbf.setNamespaceAware(true);
> > > > dbf.setValidating(true);
> > > >
> > > >
> dbf.setAttribute("http://apache.org/xml/features/validation/dynami
> > > > c", new Boolean(true));
> > > >
> > > >
> dbf.setAttribute("http://apache.org/xml/features/validation/schema
> > > > ", new Boolean(true));
> > > > db = dbf.newDocumentBuilder();
> > > > doc = db.parse(new InputSource(new StringReader(xml)));
> > > >
> > > >
> > > System.out.println(doc.getDocumentElement().getFirstChild().to
> > > String());
> > > >
> > > >
> > > > This should print out the <p0> tag. But in example 1, it prints
> > > > out a text element.
> > > >
> > > > Is this bug known? Is there a workaround?
> > > >
> > > > Thanks!
> > > >
> > > > Regards,
> > > > Thomas
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > 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]
> >
>
>
> ---------------------------------------------------------------------
> 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]