You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Andy Taylor <an...@hotmail.com> on 2003/05/05 08:01:49 UTC

Re: End of line chars being treated as content by SAX

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org

RE: End of line chars being treated as content by SAX

Posted by Rahul Srivastava <rs...@firstam.com>.
Hi Andy,

Ignorable whitespaces can be identified only when there exists a grammar for
the instance doc, and that grammar *must* be a DTD. XMLSchema do not
identify ignorable whitespaces. So, iff you have a DTD associated with your
instance, and you are using SAX parsing, then, these ignorable whitespaces
are reported by the validating parser to the ContentHandler in the
ignorableWhitespace() callback, otherwise, it is reported in the
characters()callback.

Note that the DOM feature "include-ignorable-whitespace" also works only
when there is a DTD grammar available. See:
http://xml.apache.org/xerces2-j/features.html#dom.include-ignorable-whitespa
ce

Hope that helps.

Cheers,
Rahul.


-----Original Message-----
From: Andy Taylor [mailto:andytaylormxmg@hotmail.com]
Sent: Monday, May 05, 2003 11:32 AM
To: xerces-j-user@xml.apache.org
Subject: Re: End of line chars being treated as content by SAX


On closer inspection, the problem seems to be that the server is not
ignoring any ignorable white space, including tabs spaces and end-of-line
chars.
I see there is an include-ignorable-whitespace feature for DOM but can't
seem to find anything similar for SAX.
Can anyone help me out?
Many thanks,
Andy

>From: "Andy Taylor"
>Reply-To: xerces-j-user@xml.apache.org
>To: xerces-j-user@xml.apache.org
>Subject: End of line chars being treated as content by SAX
>Date: Sun, 04 May 2003 15:42:58 +0100
>
Hi, I'm having a problem when deploying my Java/SAX application from an OSX
test environment to my Linux server.

I am using the following:
Test environment: OSX running Netbeans (with Tomcat4) Java 1.4.1, latest
Xerces
Server: Linux running JRun Java 1.4.1, latest Xerces

I put some debugging into my SAX content handler, which displayed the
current element name and characters. If I parse something like:

<element1>
  <element2>Testing1</element2>
  <element3>
    <element4>Testing2</element4>
  </element3>
</element1>

My test version would report:
element2 = Testing1
element4 = Testing2

..as expected. However, the version on my Linux server reports:
element1=

element2=Testing1
element1=

element3=

element4=Testing2
element3=

element1=

...which implies that Xerces is treating the end of line characters as
actual content.

Can anyone explain what is going on? Is there a property/feature I should
set which I haven't set? I have had problems in the past with NetBeans
apparently "setting" certain properties for me which have caused problems
when deploying on the server.

Best regards,
Andy






Chat with friends online - download MSN Messenger today.



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org