Re: [xml] Formatting question



On Wed, 2003-11-26 at 04:29, Roman Rytov wrote:
here is a snippet of XML
 
 
      <msPageCount>
      
      </msPageCount>
      <msLastAuthor>
        <value>
dimons</value>
      </msLastAuthor>
 
is there a way to get out of it:
 
      <msPageCount/>
      <msLastAuthor>
        <value>dimons</value>
      </msLastAuthor>
 
 
Pay attention to:
1. msPageCount tag has no data inside so it collapsed
2. <value>'s data is arranged on one line

In both cases, you are wanting to throw away certain leading and
trailing whitespace elements.

If you want to do this when you are parsing the document, look at the
ignorableWhitespace call in the SAX parser. If you want to do this after
you already have a DOM, you will need to do a variation on this idea:

http://mail.gnome.org/archives/xml/2003-September/msg00235.html

Cheers,
Malcolm



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