> Hi all, > I've basically written a small method that parses all elements of my XML > document. For each element, it prints out its name, value and type. I > retrieve the root node, then I retrieve its childs. Recursively I parse > childs of childs etc. > > I've made it parse this very simple doc: > <?xml version='1.0' encoding='ascii'?> > <dsi:Information xmlns='http://www.w3.org/2001/XMLSchema' > xmlns:dsi='http://www'> > <dsi:Alarm>toto</dsi:Alarm> > </dsi:Information> > > I'm surprised it returns two nodes with name #text and no value... I'm > sure this is a pretty basic question, but what do those nodes represent > ? what are they for ? They do have a value -- they have whitespace-only text, which is considered significant unless there is a DTD or schema that says it's not. Try parsing this document to understand the difference: <?xml version='1.0' encoding='ascii'?> <dsi:Information xmlns='http://www.w3.org/2001/XMLSchema' xmlns:dsi='http://www'><dsi:Alarm>toto</dsi:Alarm></dsi:Information> Dave --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Special #text nodes when parsing XML doc with DOM ?
David N Bertoni/Cambridge/IBM Fri, 28 Feb 2003 09:08:07 -0800
- Special #text nodes when parsing XML doc wit... Axelle Apvrille (LMC)
- RE: Special #text nodes when parsing XM... David N Bertoni/Cambridge/IBM
- RE: Special #text nodes when parsing XM... Erik Rydgren
- RE: Special #text nodes when parsing XM... Jesse Pelton
- Re: Special #text nodes when parsin... Axelle Apvrille (LMC)
