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 bu...@apache.org on 2003/01/31 19:40:28 UTC
DO NOT REPLY [Bug 16652] New: -
data from CDATA section is not passed for validation
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16652>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16652
data from CDATA section is not passed for validation
Summary: data from CDATA section is not passed for validation
Product: Xerces-C++
Version: 1.7.0
Platform: All
OS/Version: All
Status: NEW
Severity: Major
Priority: Other
Component: Validating Parser (Schema) (Xerces 1.5 or up only)
AssignedTo: xerces-c-dev@xml.apache.org
ReportedBy: agapon@telcordia.com
It appears that XML scanner does not pass data from CDATA section to
schema validator and thus it can not perform any sort of validation on the
corresponding element's value.
Here's an example:
************** sample.xml ****************
<?xml version="1.0"?>
<xscRoot
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="sample.xsd">
<ExternallyVisible>yes</ExternallyVisible>
<ListeningStates>
<state>a-state-1</state>
<hello><![CDATA[unsl]]></hello>
<state>a-state-2</state>
</ListeningStates>
</xscRoot>
******************************************
*************** sample.xsd ***************
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="xscRoot">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ExternallyVisible" type="xsd:string"/>
<xsd:element name="ListeningStates">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="hello">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="3"/>
<xsd:maxLength value="6"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="state" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
***********************************
my expectation was that "unsl" would be determined as a content of "hello"
element and the XML document would be found to confrom to the XML schema
by the xerces, but the schema validation actually failed, saying that
length of '0' violates minLength restriction of '3'.
I think this happens because in scanCDSection() (in XMLScanner2.cpp) data
collected from CDATA section is not passed to validator.
I've tried to search through W3 XML documentation and on the Internet in
general, but couldn't find any special considerations for validation of
CDATA content. So my assumption is that it should be given as-is to the
validator and should be validated as a regular element content.
It looks like the corresponding code is pretty much the same in 2.1.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org