Re: [xml] Blank nodes problem
- From: Daniel Veillard <veillard redhat com>
- To: Ed Day <eday obj-sys com>
- Cc: xml gnome org
- Subject: Re: [xml] Blank nodes problem
- Date: Thu, 4 Dec 2003 02:47:16 -0500
On Wed, Dec 03, 2003 at 05:45:51PM -0500, Ed Day wrote:
I am working on a DOM application in which I would like to suppress the generation of blank nodes to make
the tree easier to work with. To do this, I call xmlKeepBlanksDefault(0) which seems to work pretty well.
However, I have recently run across a situation in which I have found that if a line in an XML file does
not end with a newline character immediately after the closing '>' character, a blank node is inserted into
the DOM tree. In other words, some extra whitespace is present before the newline.
For example (using \n to represent newline), this is OK (no blank nodes):
<a>\n
<b>
this causes a blank node:
<a> \n
<b>
Is this the way it is supposed to work (i.e. is this considered 'significant' whitespace) or is this a bug?
All data whitespace are significant. Only the application really knows
what can be discarded. The xmlKeepBlanksDefault() is a trick, a leftover
from legacy APIs, it's bad in a number of ways including the fact that
it uses a global variable for changing the library behaviour.
I don't think it can be considered a bug, the behaviour can't really
be rationalized (people have tried historically and failed), with or
without xmlKeepBlanksDefault(0) some processing and checking is expected
at your level.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]