471,082 Members | 765 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Validating XML file using multiple Schema files.

Hello all,

My xml and schema file header are as follows.

1) cisGlobals.xsd.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.talgov.com/cisGlobals"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:cisGlobals="http://www.talgov.com/cisGlobals"
elementFormDefault="unqualified">
<!-- all content -->
</xsd:schema>

2) accountInformationUpdate.xsd
<xs:schema elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:cisGlobals="http://www.talgov.com/cisGlobals">
<xs:import namespace="http://www.talgov.com/cisGlobals"
schemaLocation="cisGlobals.xsd"/>
<xs:element name="AccountUpdate">
<!-- all content -->
</xs:element>
</xs:schema>

There is no default namespace defined in this schema file, but this is
importing from a schema file which has a target namespace. what would
be the namespace of this schema file.

3) cis.xml
<AccountUpdate xmlns:cisGlobals="http://www.talgov.com/cisGlobals"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.talgov.com/cisGlobals
accountInformationUpdate.xsd">
<!-- all content -->
</AccountUpdate>

Here I am using the namespace of http://www.talgov.com/cisGlobals this
is the target namespace used in first schema file. How would the
AccountUpdate and rest of the tags would be referred as.

When I try to validate the above files using MSXML4 or .Net XML class
library they fail to validate. But XML SPY validates these files
without any errors. Any ideas?

Thank you for all your help.

murali.
Jul 20 '05 #1
2 3638
Your second schema document defines names in no namespace. There is
not inheritance of target namespaces from imported schemas. So MSXML
is correct to give an error - the document your xsi:schemaLoc points
to for the cisGlobals namespace is not in fact for that namespace.

One way you could correct this is to change your instance document as
follows:

<AccountUpdate xmlns:cisGlobals="http://www.talgov.com/cisGlobals"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="accountInformationU pdate.xsd">
<!-- all content -->
</AccountUpdate>

Hope this helps,

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Jul 20 '05 #2
Thank you Henry, that helped.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Aaron P Frenger | last post: by

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.