Title: Nachricht
You'll need to set up your parser to validate, which means you need something to validate against (a DTD or a schema). You can then use the parser's setIncludeIgnorableWhitespace() method to tell the parser to omit ignorable whitespace nodes from the DOM. (Be sure to read the documentation for this method before using it, as it has some important notes.) Alternatively, you can leave the whitespace nodes in the tree and call DOMText::isIgnorableWhitespace() when processing each text node to decide whether you need to process it.


From: Sami Islam [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 26, 2005 9:06 AM
To: Jesse Pelton; xerces-c-dev@xml.apache.org; [EMAIL PROTECTED] Decisionsoft. Com
Subject: AW: XML Document parsing.

Hello,
I edited the .xml file using an editor and got rid of all the whitespace & newline chars. Now I have the correct values.
 
How can I tell the parser that I don't want whitespaces and newlines between my tags?
 
Thanks,
Sami
-----Ursprüngliche Nachricht-----
Von: Jesse Pelton [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 26. Januar 2005 14:20
An: xerces-c-dev@xml.apache.org; [EMAIL PROTECTED]
Betreff: RE: XML Document parsing.

The text may be whitespace, often used for formatting for human readability. Unless you tell the parser what whitespace is significant (via a DTD, for instance), it must retain it all.
 
<outer>
  <inner>
    text
  </inner>
</outer>
 
is not the same as
 
<outer><inner>text</inner></outer>
 
The former has a newline and some number of spaces at the start of each element, which is represented as a text node, per the XML specification.
 
That doesn't explain the null value, however. Maybe I'm barking up the wrong tree.

From: Sami Islam [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 26, 2005 7:54 AM
To: [EMAIL PROTECTED] Decisionsoft. Com; Xerces Dev List
Subject: Spam:XML Document parsing.

Hello,
When I parse an Xerces XMLDoc using Pathan library I receive 2 nodes for each child node.
1) Text Node = "#text", even when there is no text for the element.
2) Element Node.

And funnily I get the child value only if I do a (child_node)->getNodeValue() on the node of type Element and a null on the node of type Text. Why?

Regards,
Sami

Reply via email to