Groups | Blog | Home
all groups > dotnet xml > january 2006 >

dotnet xml : xml validation error for a schema which using XML Enveloped signat


Kenny Ho
1/15/2006 8:55:02 PM
Hi,
I have written the following schema that contains the XML signature:

-----------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://mycompany/integrity/v1.0"
elementFormDefault="qualified"
xmlns="http://mycompany/integrity/v1.0"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"
schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd" />
<xs:element name="Integrity">
<xs:complexType>
<xs:sequence>
<xs:element name="File" type="xs:string" minOccurs="1"
maxOccurs="unbounded" />
<xs:element ref="ds:Signature" minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
-----------------------------------------------------------------------

I want to use the Enveloped Signature, and the xml file is like this:

-----------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<Integrity xmlns="http://mycompany/integrity/v1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mycompany/integrity/v1.0">
<File>room.vsd</File>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="">
<Transforms>
<Transform
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>pMTBUf9u//G8YAazstaFWQBBLWM=</DigestValue>
</Reference>
</SignedInfo>

<SignatureValue>seM4iVh7tx1YN+a1+w0wYI86+27NN/a8kkXdappoM7+ySXUHrCFtrqkNmrh7t19cAZmUc1tGG0DgaPLvCPZ3hTE3qKIVsxOX7juA16WceYBd6j8if+4jpMpJhr0g49KJrINSKo5fk8hDyOf4Cy5KNpROc72Xt4TaECSa8Y4rVTI=</SignatureValue>
<KeyInfo>
<KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#">
<RSAKeyValue>

<Modulus>tkZvN7OWALZazI2UnftRFP+ztxWKq8abaOgt3VEyUWN/4hGow+EA4aYe20yWl/jW8ZPGQm62pda/jwPGyyH4E5DMNUsSmcCZLtJWC3IqzbVmyF9EYGNUVwSDiYYsYLETODa2loMarbEEPnQmTWQCO6zkhwCxcC7aPkvKmkAX5lk=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</Signature>
</Integrity>
-----------------------------------------------------------------------

However, when I run the xml schema validation, it shows the following error:
-----------------------------------------------------------------------
System.Exception: The 'URI' attribute has an invalid value according to its
data
type. An error occurred at , (8, 18).
-----------------------------------------------------------------------

The error location location is <Reference URI="">, in xml signature's
part. It seems that the URI can't accept empty string.
In fact, the xml data file is correct, but fails in schema validation.
Does anybody know what the problem is? Is it a .Net's bug? Any way to solve
this problem? Thanks so much!

(I am using .NET 1.1; winXP sp2)


Kenny Ho
Priya Lakshminarayanan
1/18/2006 5:46:11 PM
..NET 1.1 does not accept empty string as a valid value for xs:anyURI type.
Before validation, you can run it through a transform that strips all the
URI attributes with empty values.

Thanks,
Priya

[quoted text, click to view]

AddThis Social Bookmark Button