You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by li...@ecommony.com on 2000/06/25 15:35:14 UTC
schema doesn't appear to work for me ??
Hello
I've been trying to validate a file using schema and xerces 1.1.2 but to no
avail.
Here is the beggining of my schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd=" http://www.w3.org/1999/XMLSchema
<http://www.w3.org/1999/XMLSchema> ">
<xsd:group>
<xsd:element name="data" type="dataType"/>
</xsd:group>
<xsd:complexType name="dataType">
<xsd:group>
<xsd:sequence>
<xsd:element name="sender"
type="senderType"/>
<xsd:element name="transactions"
type="transactionsType"/>
<xsd:element name="data_result"
type="data_resultType"/>
</xsd:sequence>
</xsd:group>
<xsd:attribute name="version" type="xsd:integer"/>
</xsd:complexType> ...
Here is the beggining of my XML:
<?xml version="1.0"?>
<data version="1" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://lior:7001/p2cschema.xsd">
<sender>
<name>Pay2Card</name>
<mpid>10060201503PAY253003</mpid>
</sender>
<transactions>
And finally here's the relevant piece of my java code:
DOMParser parser = new DOMParser();
parser.setFeature("http://xml.org/sax/features/validation",true);
parser.setFeature("http://xml.org/sax/features/namespaces",true);
parser.setFeature("http://apache.org/xml/features/validation/schema",true);
parser.parse(xmlFile); ...
When i run this, i get a printing of [Error] attribute version not found in
element type data
even though there is a version attribute in the xml and in the schema. If i
remove from the schema all the namespace declarations(xsd:) then this error
dissapears and no other errors occur, even if i plant errors in the xml that
should be picked up by the schema validator
Please, does somebody know what i'm doing wrong ??
Thankyou, Lior Shapira
lior@ecommony.com <ma...@ecommony.com>
Re: schema doesn't appear to work for me ??
Posted by Eric Ye <er...@locus.apache.org>.
Would you mind post the complete schema and xml document?
_____
Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org
----- Original Message -----
From: lior@ecommony.com
To: xerces-j-dev@xml.apache.org
Sent: Sunday, June 25, 2000 6:35 AM
Subject: schema doesn't appear to work for me ??
Hello
I've been trying to validate a file using schema and xerces 1.1.2 but to no avail.
Here is the beggining of my schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<xsd:group>
<xsd:element name="data" type="dataType"/>
</xsd:group>
<xsd:complexType name="dataType">
<xsd:group>
<xsd:sequence>
<xsd:element name="sender" type="senderType"/>
<xsd:element name="transactions" type="transactionsType"/>
<xsd:element name="data_result" type="data_resultType"/>
</xsd:sequence>
</xsd:group>
<xsd:attribute name="version" type="xsd:integer"/>
</xsd:complexType> ...
Here is the beggining of my XML:
<?xml version="1.0"?>
<data version="1" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://lior:7001/p2cschema.xsd">
<sender>
<name>Pay2Card</name>
<mpid>10060201503PAY253003</mpid>
</sender>
<transactions>
And finally here's the relevant piece of my java code:
DOMParser parser = new DOMParser();
parser.setFeature("http://xml.org/sax/features/validation",true);
parser.setFeature("http://xml.org/sax/features/namespaces",true);
parser.setFeature("http://apache.org/xml/features/validation/schema",true);
parser.parse(xmlFile); ...
When i run this, i get a printing of [Error] attribute version not found in element type data
even though there is a version attribute in the xml and in the schema. If i remove from the schema all the namespace declarations(xsd:) then this error dissapears and no other errors occur, even if i plant errors in the xml that should be picked up by the schema validator
Please, does somebody know what i'm doing wrong ??
Thankyou, Lior Shapira
lior@ecommony.com