Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
Hello All,
Here is my problem:
i have an xml file which has some values and also this file is certificate signed.
my xsd schema file knows how to handle only the values, while when adding the signature lines the schema fails.
the error is:
The element 'Header' has invalid child element 'Signature' in namespace 'http://www.w3.org/2000/09/xmldsig#'. List of possible elements expected 'Signature'
here is my code following,
Thanks :)

File test.xml:
<pre lang="xml">
    <Header>
    <tank>
        <code>1</code>
        <level>0</level>
    </tank>

    <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
            ...
        <SignedInfo>
    </Signature>
    </Header>


SchemaTest.xsd:

XML
<?xml version="1.0"?>
    <xs:schema id="SchemaTest"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefalut="qualified"
    attributeFormDefault="unqualified">
    <xs:element name="Header">
        <xs:complexType>
        <xs:sequence>
            <xs:element name="tank">
            <xs:complexType>
            <xs:sequence>
                <xs:element name="code"/>
                <xs:element name="level"/>
                </xs:sequence>
            </xs:complexType>
            </xs:element>
            <xs:element name="Signature">
                    <xs:complexType>
                    <xs:sequence>
                        <xs:element name="SignedInfo">
                        <xs:complexType>
                        <xs:sequence>
                        </xs:sequence>
                        </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                    </xs:complexType>
            </xs:element>
            </xs:sequence>
            </xs:complexType>
    </xs:element>
    </xs:schema>
Posted
Comments
Sergey Alexandrovich Kryukov 16-Sep-13 2:18am    
There is nothing about this namespace in the schema. Why not removing this namespace?
—SA
eyalle 16-Sep-13 2:26am    
the namespace given by the certificate signature is something im not controlling,it's part of the sign file process.

Sergey Alexandrovich Kryukov 16-Sep-13 2:29am    
Hm. Than the schema is wrong. These two files don't match as the schema and its instance...
—SA
eyalle 16-Sep-13 3:06am    
any idea how ??
Sergey Alexandrovich Kryukov 16-Sep-13 3:23am    
Sorry, I have no idea...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900