classpathx-xml
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Classpathx-xml] Aelfred2 problem with whitespace


From: Maarten Coene
Subject: [Classpathx-xml] Aelfred2 problem with whitespace
Date: Fri, 06 Aug 2004 12:20:35 +0200
User-agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)

Hi,

thanks for fixing my previous problems, however I'm having a new problem: the Aelfred2 parser removes the whitespace in my element content.

For instance, if I parse the following document:
   <root>&lt;head&gt; &amp; &lt;body&gt;</root>
the spaces before and after the "&amp;" are lost!!

Here is some code that illustrates the problem:

   public void testWhitespace() throws Exception {
       String xml = "<root>&lt;head&gt; &amp; &lt;body&gt;</root>";
       InputStream in = new ByteArrayInputStream(xml.getBytes());
SAXParserFactory factory = new JAXPFactory();
       factory.newSAXParser().parse(in, new DefaultHandler2() {
           public void characters(char[] ch, int start, int end) {
               System.out.print(new String(ch, start, end));
           }
       });
   }

This is the output I'm getting:
<head>&<body>

but I was expecting this output:
<head> & <body>


regards,
Maarten






reply via email to

[Prev in Thread] Current Thread [Next in Thread]