[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Can't validate xml with schema

Subject: Can't validate xml with schema
From: "SINGH Navpreet" <Navpreet.SINGH@xxxxxxxxx>
Date: Fri, 14 Sep 2007 11:44:24 +1000
 Can't validate xml with schema
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.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.