473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

xml validation error for a schema which using XML Enveloped signat

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+ySXUHrCFtrqkNmrh7t19cAZmUc1tGG0DgaPLv CPZ3hTE3qKIVsxOX7juA16WceYBd6j8if+4jpMpJhr0g49KJrI NSKo5fk8hDyOf4Cy5KNpROc72Xt4TaECSa8Y4rVTI=</SignatureValue>
<KeyInfo>
<KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#">
<RSAKeyValue>

<Modulus>tkZvN7OWALZazI2UnftRFP+ztxWKq8abaOgt3VEyU WN/4hGow+EA4aYe20yWl/jW8ZPGQm62pda/jwPGyyH4E5DMNUsSmcCZLtJWC3IqzbVmyF9EYGNUVwSDiYYsYL ETODa2loMarbEEPnQmTWQCO6zkhwCxcC7aPkvKmkAX5lk=</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

Jan 16 '06 #1
1 2416
..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

"Kenny Ho" <Kenny Ho@discussions.microsoft.com> wrote in message
news:77**********************************@microsof t.com...
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+ySXUHrCFtrqkNmrh7t19cAZmUc1tGG0DgaPLv CPZ3hTE3qKIVsxOX7juA16WceYBd6j8if+4jpMpJhr0g49KJrI NSKo5fk8hDyOf4Cy5KNpROc72Xt4TaECSa8Y4rVTI=</SignatureValue>
<KeyInfo>
<KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#">
<RSAKeyValue>

<Modulus>tkZvN7OWALZazI2UnftRFP+ztxWKq8abaOgt3VEyU WN/4hGow+EA4aYe20yWl/jW8ZPGQm62pda/jwPGyyH4E5DMNUsSmcCZLtJWC3IqzbVmyF9EYGNUVwSDiYYsYL ETODa2loMarbEEPnQmTWQCO6zkhwCxcC7aPkvKmkAX5lk=</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

Jan 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sudip Chakraborty | last post by:
Is there a way to see constraint validation errors while loading xml into a DataSet ? I'm interested in the line number in the xml file which is causing the error. I've enclosed the relevant stack...
2
by: Shone | last post by:
I would like to perform a 2-pass XML reading from a stream. Once using the Validating reader, just to confirm the validity against the schema, and next time to do a reading to extract the data....
2
by: Marcin Cenkier | last post by:
Hi, I want to validate a DOM document, and if I build DOM from a stream using documentBuilder.parse() validation using validator.validate(DOMSource) works, but if I create the same document...
3
by: Raghu | last post by:
I have following schema: <?xml version="1.0" encoding="utf-8"?> <xs:schema elementFormDefault="qualified" targetNamespace="http://mycompany.services.customer2/types/restricted"...
4
by: Igor Koretsky | last post by:
Hi. Using VB.Net System.Xml 1.0 SchemaCollection Object I am getting an error when trying to add ‘Schema A’ to the SchemaCollection. Here are my schema files..
5
by: paul_zaoldyeck | last post by:
does anyone know how to validate an xml file against multiple defined schema? can you show me some examples? i'm making here an xml reader.. thank you
7
by: christian.eickhoff | last post by:
Hi Everyone, I am currently implementing an XercesDOMParser to parse an XML file and to validate this file against its XSD Schema file which are both located on my local HD drive. For this...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
0
by: tanish2k | last post by:
hi. I am using c#, visual studio 2003. I need to validate a xml file against schema which itself has 2 more schema imported under it. i have following 2 xsd files : xsd1 --->...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.