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 2001/09/18 12:18:19 UTC
DO NOT REPLY [Bug 3683] New: -
Access violation when performing custom schema 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=3683>.
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=3683
Summary: Access violation when performing custom schema
validation
Product: Xerces-C++
Version: 1.5.1
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Validating Parser (Schema) (Xerces 1.5 or up only)
AssignedTo: xerces-c-dev@xml.apache.org
ReportedBy: AntAGrey@Hotmail.com
I get an access violation when attempting to perform DOM validation of an XML
against a schema using a custom schema validation class. I get the same error
even if I make my custom validation class the base SchemaValidator class:
SchemaValidator* myValidator = new SchemaValidator;
DOMParser parser( myValidator );
The access violation occurs in XMLStringPool::getId() method, it doesn't seem
to handle NULL toFind parameters. The method is invoked from the
XMLScanner::scanStartTagNS() method to obtain the element (no prefix). The
fGrammar->getTargetNamespace() method used returns NULL, so the fURIStringPool-
>getId() produces an access violation within the XMLStringPool::getId() method
(in the while loop on *curCh). The following call stack traces the error:
XMLString::hash(const unsigned short * const 0x00000000, const unsigned int
109) line 1083
HashXMLCh::getHashVal(const void * const 0x00000000, unsigned int 109) line 70
+ 13 bytes
RefHashTableOf<XMLStringPool::PoolElem>::findBucketElem(const void * const
0x00000000, unsigned int & 1244056) line 273 + 27 bytes
RefHashTableOf<XMLStringPool::PoolElem>::get(const void * const 0x00000000)
line 220 + 16 bytes
XMLStringPool::getId(const unsigned short * const 0x00000000) line 174 + 15
bytes
XMLScanner::scanStartTagNS(unsigned char & 1) line 2898 + 87 bytes
XMLScanner::scanContent(const unsigned char 0) line 1512
XMLScanner::scanDocument(const InputSource & {...}, const unsigned char 0) line
374 + 10 bytes
XMLScanner::scanDocument(const unsigned short * const 0x007d78a0, const
unsigned char 0) line 321
XMLScanner::scanDocument(const char * const 0x007d1430, const unsigned char 0)
line 330
DOMParser::parse(const char * const 0x007d1430, const unsigned char 0) line 308
main(int 5, char * * 0x007d13d0) line 205
mainCRTStartup() line 338 + 17 bytes
KERNEL32! 77f1ba06()
The reason that the fGrammar->getTargetNamespace() method returns NULL is that
the namespace hasn't been set. This is only set via use of a TraverseSchema
class, done in XMLScanner::resolveSchemaGrammar() method. This, however, is
only performed if the current grammar has not been set, or for DTD validation.
For custom owner schema validation, the grammar has already been set in
XMLScanner::scanReset().
Strangely enough, for a non custom user validator, using schema validation, the
XMLScanner::scanReset() method sets the grammar to DTD grammar, regardless of
what type of validation is being performed. This ensures that additional DOM
parsing is performed in the XMLScanner::resolveSchemaGrammar() method even
though schema grammar has been selected.
Attached is a copy of my simple XML and XSD:
<?xml version="1.0" encoding="UTF-8"?>
<ServiceCall xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="My test.xsd">
<MiddlewareHeader version="1.0">
<INF_SVCNAME Row="1">
<INF_SVCNAME_VALUE>
LOGIN
</INF_SVCNAME_VALUE>
</INF_SVCNAME>
<INF_VERSIONNO Row="2">
<INF_VERSIONNO_VALUE>
2.0
</INF_VERSIONNO_VALUE>
</INF_VERSIONNO>
</MiddlewareHeader>
</ServiceCall>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="ServiceCall">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="MiddlewareHeader" minOccurs='1' maxOccurs='1'/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MiddlewareHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="INF_SVCNAME" type="INF_SVCNAME"
nillable="false"/>
<xsd:element name="INF_VERSIONNO" type="INF_VERSIONNO"
nillable="false"/>
</xsd:sequence>
<xsd:attribute name="version" type="xsd:string" use='required'/>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="INF_SVCNAME">
<xsd:sequence>
<xsd:element name="INF_SVCNAME_VALUE">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:whiteSpace
value="preserve"/>
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Row" type="xsd:integer" use="optional"/>
</xsd:complexType>
<xsd:complexType name="INF_VERSIONNO">
<xsd:sequence>
<xsd:element name="INF_VERSIONNO_VALUE">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:whiteSpace
value="preserve"/>
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Row" type="xsd:integer" use="optional"/>
</xsd:complexType>
</xsd:schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org