You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Xiaofan Zhou <Xi...@businessobjects.com> on 2004/11/05 18:11:29 UTC
CData section
Hi, All,
I have a question regarding CData Section, say I have an element
<cust_info> in XML defined as following:
<cust_info>
<![CDATA[ Customer<!1> ]]>
</cust_info>
When I use the SAX parser in Xerces-c, I got the character data for the
element "Customer<!1>", is this the expected behavior? I thought the
data should be the whole thing: <![CDATA[ Customer<!1> ]]>, that is,
come out the parser without parsing it.
Thanks for clarifying in advance.
Frank
Re: CData section
Posted by da...@us.ibm.com.
> I have a question regarding CData Section, say I have an element
<cust_info>
> in XML defined as following:
>
> <cust_info>
> <![CDATA[ Customer<!1> ]]>
> </cust_info>
>
> When I use the SAX parser in Xerces-c, I got the character data for the
element "Customer<!1>",
> is this the expected behavior?
Yes.
> I thought the data should be the whole thing: <![CDATA[ Customer<!1>
]]>, that is,
> come out the parser without parsing it.
No, the characters that delimit a CDATA section are markup, and markup is
never reported by a SAX parser. It's only the character _within_ the
CDATA section that are not interpreted as markup. However, a SAX2 parser,
with a LexicalHandler installed will report the boundaries of any CDATA
sections.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org