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 Davide Fais <da...@yahoo.it> on 2006/06/13 17:15:23 UTC
error in schema validation
Hi at all,
I'm using the version 2.6.2 of Xerces-J and I have tried to validate
the xml code at the bottom of the email against xml schema,
that you can download from "http://www.w3.org/2000/09/xmldsig#",
but I got the following error
Error: cvc-complex-type.2.4.b: The content of element
'SignatureProperty' is not complete. One of
'{WC[##other:"http://www.w3.org/2000/09/xmldsig#"]}' is expected. line
31, column 96
I think the error refers to the follwing part of XML Schema:
<element name="SignatureProperty" type="ds:SignaturePropertyType"/>
<complexType name="SignaturePropertyType" mixed="true">
<choice maxOccurs="unbounded">
<any namespace="##other" processContents="lax"/>
<!-- (1,1) elements from (1,unbounded) namespaces -->
</choice>
<attribute name="Target" type="anyURI" use="required"/>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
but in the code I don't use any other namespace element,
but I should be able to insert a text because attribute
"mixed" has value "true". So I don't understand the error of the parser.
I have used the following code
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser parser = spf.newSAXParser();
org.xml.sax.XMLReader xmlReader = parser.getXMLReader();
xmlReader.setFeature("http://xml.org/sax/features/namespaces",true);
xmlReader.setFeature("http://xml.org/sax/features/validation",true);
xmlReader.setFeature("http://apache.org/xml/features/validation/dynamic",false);
xmlReader.setFeature("http://apache.org/xml/features/validation/schema",true);
xmlReader.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true);
xmlReader.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation",
ns + " " + schemaFile);
// serializes the DOM element to a String
String s = DOMPrinter.printToString(element);
ByteArrayInputStream bais = new ByteArrayInputStream(s.getBytes());
xmlReader.setErrorHandler(errorHandler);
org.xml.sax.InputSource inputSource = new org.xml.sax.InputSource(bais);
xmlReader.parse(inputSource);
Has anybody got an idea because I get that error?
Could it be a bug of Xerces?
Thanks in advance.
Davide.
--------------------------------------------------------------------------
This xml code fails validation.
<Signature Id="signature" xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1">
</SignatureMethod>
<Reference Id="reference-1" URI="#object2">
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue></DigestValue>
</Reference>
<Reference URI="#property-1">
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue></DigestValue>
</Reference>
<Reference URI="#reference-1">
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue></DigestValue>
</Reference>
</SignedInfo>
<SignatureValue/>
<KeyInfo>
<KeyValue>
<RSAKeyValue>
<Modulus>ALHrjVBGZ04DR5LpAWSgmm4DvOdtkrWr164ywM4AYdPB7i5gB2Z2YXndDaTtkd59VU5MKOgD9Ek9mdHE2j9PaYFFh+gc8cnnW1ISlSx8MRvUWpNKyH5eLwXO3AzSsM1E0AsxFDq2OHfpzLhX2nEa1YXwXhxpww7T3AzN4V+aDyZL</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
<Object Id="object1">Gianni Sindaco</Object>
<Object Id="object2">
<SignatureProperties>
<SignatureProperty Id="property-1" Target="#signature">Date =
02/05/2002</SignatureProperty>
<SignatureProperty Id="property-2" Target="#signature">Date =
02/05/2002, Tuesday</SignatureProperty>
</SignatureProperties></Object>
</Signature>
----------------------------------------------------------------------
Chiacchiera con i tuoi amici in tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
Re: error in schema validation
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hello Davide,
Davide Fais <da...@yahoo.it> wrote on 06/13/2006 11:15:23 AM:
> Hi at all,
>
> I'm using the version 2.6.2 of Xerces-J and I have tried to validate
> the xml code at the bottom of the email against xml schema,
> that you can download from "http://www.w3.org/2000/09/xmldsig#",
> but I got the following error
>
> Error: cvc-complex-type.2.4.b: The content of element
> 'SignatureProperty' is not complete. One of
> '{WC[##other:"http://www.w3.org/2000/09/xmldsig#"]}' is expected. line
> 31, column 96
>
>
> I think the error refers to the follwing part of XML Schema:
>
> <element name="SignatureProperty" type="ds:SignaturePropertyType"/>
> <complexType name="SignaturePropertyType" mixed="true">
> <choice maxOccurs="unbounded">
> <any namespace="##other" processContents="lax"/>
> <!-- (1,1) elements from (1,unbounded) namespaces -->
> </choice>
> <attribute name="Target" type="anyURI" use="required"/>
> <attribute name="Id" type="ID" use="optional"/>
> </complexType>
>
> but in the code I don't use any other namespace element,
> but I should be able to insert a text because attribute
> "mixed" has value "true". So I don't understand the error of the parser.
The content of "SignatureProperty" must contain one or more instances of
the wildcard so you must specify at least one element from a namespace
other than "http://www.w3.org/2000/09/xmldsig#". If it only contains text
it isn't valid.
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
Re: error in schema validation
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hello Davide,
Davide Fais <da...@yahoo.it> wrote on 06/13/2006 11:15:23 AM:
> Hi at all,
>
> I'm using the version 2.6.2 of Xerces-J and I have tried to validate
> the xml code at the bottom of the email against xml schema,
> that you can download from "http://www.w3.org/2000/09/xmldsig#",
> but I got the following error
>
> Error: cvc-complex-type.2.4.b: The content of element
> 'SignatureProperty' is not complete. One of
> '{WC[##other:"http://www.w3.org/2000/09/xmldsig#"]}' is expected. line
> 31, column 96
>
>
> I think the error refers to the follwing part of XML Schema:
>
> <element name="SignatureProperty" type="ds:SignaturePropertyType"/>
> <complexType name="SignaturePropertyType" mixed="true">
> <choice maxOccurs="unbounded">
> <any namespace="##other" processContents="lax"/>
> <!-- (1,1) elements from (1,unbounded) namespaces -->
> </choice>
> <attribute name="Target" type="anyURI" use="required"/>
> <attribute name="Id" type="ID" use="optional"/>
> </complexType>
>
> but in the code I don't use any other namespace element,
> but I should be able to insert a text because attribute
> "mixed" has value "true". So I don't understand the error of the parser.
The content of "SignatureProperty" must contain one or more instances of
the wildcard so you must specify at least one element from a namespace
other than "http://www.w3.org/2000/09/xmldsig#". If it only contains text
it isn't valid.
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org