Hi Simon,
Thanks for the reply. But there's one more problem. After getting the DOM, when I traverse it for the first time, to assign a key to each node, then these text nodes doesnt seem to be there, because the key is not assigned to them (I dont think that these nodes are null). When I travel the DOM second time (to make some changes to it), then they appear in between. What can be the reason for that ??
Also, I would like to know, if there is any other possible solution for removing these text nodes, rather than modifying the DTD (which I dont want to do at any cost).
Thanks,
Rahul
Simon Kitching <[EMAIL PROTECTED]> wrote:
Hi Rahul,
On Sun, 2003-07-13 at 04:48, Rahul Agarwal wrote:
> Hi,
> In the DOM sructure, many empty text nodes appear,
> probably one below each structure (element, attr,
> etc).
> Is there anyway I can prevent them from occuring in
> the structure ?? Or can I remove them ??
If you have a document like this, and no DTD or schema:
then in the resulting DOM, node "foo" has 3 children:
* a linefeed (note: not "empty")
* a bar element
* a linefeed (note: not "empty")
If you don't want this behaviour, you can provide an XML schema which
specifies that node "foo" has element content only; the parser then
knows that all whitespace within foo can be ignored. I think a DTD can
also be used to specify element-only-content but am not absolutely sure.
Without a DTD or Schema, the parser can't throw away text within foo
(even whitespace) because it *might* be important to the calling
program.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
