They represent the whitespace (line breaks) between your elements. If you
want to ignore whitespace, you'll have to provide a DTD to the parser so it
can determine what can safely be ignored.

-----Original Message-----
From: Axelle Apvrille (LMC) [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 11:57 AM
To: [EMAIL PROTECTED]
Subject: Special #text nodes when parsing XML doc with DOM ?


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 ?

This is the output of my program:
Retrieving all nodes of the document
Root
  Name = dsi:Information
  Value= (null)
  Type = 1

- Name   = #text  <<<<<<<<<<<<<<<<<< what's this node for ?
- Value  =        
                  <<<<<<<<<<<<<<<<<< no value ?
- Type   = 3
- Prefix = (null)

- Name   = dsi:Alarm
- Value  = (null)
- Type   = 1
- Prefix = dsi

-- Name   = #text  
-- Value  = toto
-- Type   = 3
-- Prefix = (null)

-- Name   = #text  <<<<<<<<<<<<<<<<<< what's this node for ?
-- Value  =
                   <<<<<<<<<<<<<<<<<< no value ?
-- Type   = 3
-- Prefix = (null)

Thanks very much
Axelle.

---------------------------------------------------------------------
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