xsl-list
[Top] [All Lists]

[xsl] Can't validate xml with schema

2007-09-13 18:44:48
Hi all,
Not sure if I should be posting xml schema post to here. If not can you
please suggest me where to post it.

I have two schemas (one local, another on server) they are exactly same
root element definition. Local schema validates xml file, but validating
same file against remote schema I am getting XMLSpy error as follows:

File C:\Documents and Settings\singhn\Desktop\Copy of r1CfgItm.xml is
not valid.
        Element <test> is not allowed under element <loadInstructions>.
                Reason: The following elements are expected at this
location (see below)
                        <test> 
                Error location: loadInstructions / test
                Details
                        cvc-model-group: Element <test> unexpected by
type '{anonymous}' of element <loadInstructions>.
                        cvc-elt.5.2.1: The element <loadInstructions> is
not valid with respect to the actual type definition '{anonymous}'.

Following is the xml document
<?xml version="1.0" encoding="UTF-8"?>
<loadInstructions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="C:/apps/test.xsd">
        <test>test</test>
        <test1>3</test1>
</loadInstructions>

And local schema file

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
        <xs:element name="loadInstructions">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="test"
type="xs:string"/>
                                <xs:element name="test1"
type="xs:integer"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>

But when I change the <loadInstructions> to be validated by remote
schema as follows

<?xml version="1.0" encoding="UTF-8"?>
<loadInstructions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://a995760/pub/Resources/Validation";
xsi:schemaLocation="http://a995760/pub/Resources/Validation
http://a995760/pub/Resources/Validation/test.xsd";>
        <test>test</test>
        <test1>3</test1>
</loadInstructions>

And remote schema file

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://a995760/pub/Resources/Validation";>
        <xs:element name="loadInstructions">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="test"
type="xs:string"/>
                                <xs:element name="test1"
type="xs:integer"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>

XmlSpy throws error described above. Can anyone help me here.

Thanks and regards
Navpreet Singh

Disclaimer :
The contents of this e-mail including any attachments are intended only
for the person or entity to which this e-mail is addressed.  If you are not,
or believe you may not be, the intended recipient, please advise the sender
immediately by return e-mail, delete this e-mail and destroy any copies.
Tenix does not warrant nor guarantee that this email communication is free
from errors, virus, interception or interference.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>