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().toString());
>
>
> 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]

Reply via email to