How can I specify this (element content only - no text nodes)?

Ron Rothblum
Active Technologies Department
IBM Haifa Research Labs
Phone:   +972 4 829-6459


|---------+---------------------------->
|         |           Simon Kitching   |
|         |           <[EMAIL PROTECTED]|
|         |           co.nz>           |
|         |                            |
|         |           14/07/2003 02:53 |
|         |           Please respond to|
|         |           xerces-j-user    |
|---------+---------------------------->
  
>--------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                 |
  |       To:       [EMAIL PROTECTED]                                           
                      |
  |       cc:                                                                   
                                 |
  |       Subject:  Re: Empty Text nodes in DOM structure                       
                                 |
  
>--------------------------------------------------------------------------------------------------------------|




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:
<foo>
<bar/>
</foo>
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]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to