• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML parser skips mutiple whitespaces while parsing a xml list element

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<p>I have a list like {“A”,””,”C”}.I serialise it into a text file as a xml list element . The serialized string turns out to be “A C” (two spaces between A and C)
<p>But XML SAX parser parses it to “A C” with a single space between them(consolidates mutiple spaces to one space)
<p>In my program I take the parsed string(A C) and apply a java split function on it. It gives me a list {"A","C"} .The empty space has been dropped.
<br>
After i did some googling i found that
<ol>
<li>XML SAX parser parses:
All non-space characters (tab and new-line) are translated into a space character, and all multiple space characters are consolidated
into a single space.</li>
<li>And also The restriction <whitespace value=”preserve”> which is the support given by the XML to preserve whitespaces will work only on the string based elements and not on <xsd:list> element</li>
</ol>
<p>
Can you please confirm whether the above information is correct?Is there any parser setting to preseve the mutiple whitespaces in a list element while parsing. I am using a Xerces SAX parser.
<p> My work is held up cause of this issue. Can anyone please help out?
<p>Thanks in advance!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic