473,378 Members | 1,110 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,378 software developers and data experts.

question on "include" in schema files (.xsd). Trouble validating schema in .NET

Hi,

I hope someone can please help me. I'm having a lot of trouble with
schema files in .NET. I have produced a very simple example that uses
"include" to include other schema files. It all works with SPY, but
when I pick "Validate Schema" from the .NET 2003 menu, it fails with
message:

"Type XType is not declared." As I hinted at in my subject line, I
suspect that it has to do with including another schema multiple times.
Can someone tell me how this should be done? Possibly, SPY or .NET do
not conform to the standard. Is there a reference somewhere to this.
I'm somewhat at others mercy as the schema files are given to us by a
third party that claims, "hey they work with SPY!". If I can come up
with a specific solution though, I can probably force them to comply.

Here are the scema files. Notice I include Common_dataTypes.xsd in the
main schema AND I include it in common_PointRecord.xsd
which is itself included in RecordOfInterest.xsd
which is in turn included in main.xsd. Again, I suspect that include
files twice is the real problem. Is there a limit or rule on multiple
includes of schema files?

Any help would be greatly appreciated.

Thanks,

Andrew

main.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://test/schemas"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test/schemas" elementFormDefault="qualified">
<xsd:include schemaLocation="Common_dataTypes.xsd"/>
<xsd:include schemaLocation="RecordOfInterest.xsd"/>
<xsd:element name="PRIMARY_QUERY">
<xsd:complexType>
<xsd:all>
<xsd:element name="Id" type="standardIdentifierType"/>
<xsd:element name="RecordOfInterestobj" type="RecordOfInterest"
minOccurs="0"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>

commonDataTypes.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:simpleType name="XType">
<xsd:restriction base="xsd:double">
<xsd:minInclusive value="-10.0"/>
<xsd:maxInclusive value="10.0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="YType">
<xsd:restriction base="xsd:double">
<xsd:minInclusive value="-18.0"/>
<xsd:maxInclusive value="18.0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="standardIdentifierType">
<xsd:restriction base="xsd:token">
<xsd:maxLength value="128"/>
<xsd:minLength value="1"/>
<xsd:pattern value="[0-9A-Za-z_\.\-]+"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
RecordOfInterest.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://test/schemas"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test/schemas" elementFormDefault="qualified">
<xsd:include schemaLocation="common_PointRecord.xsd"/>
<xsd:complexType name="RecordOfInterest">
<xsd:all>
<xsd:element name="DATA">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="TempData" type="PointRecord" minOccurs="3"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:schema>

common_PointRecord.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:include schemaLocation="Common_dataTypes.xsd"/>
<xsd:complexType name="PointRecord">
<xsd:all>
<xsd:element name="X" type="XType">
</xsd:element>
<xsd:element name="Y" type="YType">
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:schema>

Nov 12 '05 #1
4 2257
This is a known issue regarding chameleon includes in .net framework 1.1.
This is fixed .net framework 2.0 in the new schema store - XmlSchemaSet.

Thanks,
Zafar

<bi*********@yahoo.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hi,

I hope someone can please help me. I'm having a lot of trouble with
schema files in .NET. I have produced a very simple example that uses
"include" to include other schema files. It all works with SPY, but
when I pick "Validate Schema" from the .NET 2003 menu, it fails with
message:

"Type XType is not declared." As I hinted at in my subject line, I
suspect that it has to do with including another schema multiple times.
Can someone tell me how this should be done? Possibly, SPY or .NET do
not conform to the standard. Is there a reference somewhere to this.
I'm somewhat at others mercy as the schema files are given to us by a
third party that claims, "hey they work with SPY!". If I can come up
with a specific solution though, I can probably force them to comply.

Here are the scema files. Notice I include Common_dataTypes.xsd in the
main schema AND I include it in common_PointRecord.xsd
which is itself included in RecordOfInterest.xsd
which is in turn included in main.xsd. Again, I suspect that include
files twice is the real problem. Is there a limit or rule on multiple
includes of schema files?

Any help would be greatly appreciated.

Thanks,

Andrew

main.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://test/schemas"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test/schemas" elementFormDefault="qualified">
<xsd:include schemaLocation="Common_dataTypes.xsd"/>
<xsd:include schemaLocation="RecordOfInterest.xsd"/>
<xsd:element name="PRIMARY_QUERY">
<xsd:complexType>
<xsd:all>
<xsd:element name="Id" type="standardIdentifierType"/>
<xsd:element name="RecordOfInterestobj" type="RecordOfInterest"
minOccurs="0"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>

commonDataTypes.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:simpleType name="XType">
<xsd:restriction base="xsd:double">
<xsd:minInclusive value="-10.0"/>
<xsd:maxInclusive value="10.0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="YType">
<xsd:restriction base="xsd:double">
<xsd:minInclusive value="-18.0"/>
<xsd:maxInclusive value="18.0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="standardIdentifierType">
<xsd:restriction base="xsd:token">
<xsd:maxLength value="128"/>
<xsd:minLength value="1"/>
<xsd:pattern value="[0-9A-Za-z_\.\-]+"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
RecordOfInterest.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://test/schemas"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test/schemas" elementFormDefault="qualified">
<xsd:include schemaLocation="common_PointRecord.xsd"/>
<xsd:complexType name="RecordOfInterest">
<xsd:all>
<xsd:element name="DATA">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="TempData" type="PointRecord" minOccurs="3"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:schema>

common_PointRecord.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:include schemaLocation="Common_dataTypes.xsd"/>
<xsd:complexType name="PointRecord">
<xsd:all>
<xsd:element name="X" type="XType">
</xsd:element>
<xsd:element name="Y" type="YType">
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:schema>

Nov 12 '05 #2
Zafar,

Thanks for the response.

Can you give me an example of how to fix the problem? I did some
checking, and the term "targetNamespace" came up. I tried adding the
same targetNamespace to all child schemas without success. That is, I
added "targetNamespace="http://test/schemas"" to all the schemas. Is
there something else I need to do?

Thank you,

Andrew

Nov 12 '05 #3
Add this to the xs:schema element in the common_PointRecord.xsd schema.

targetNamespace="http://test/schemas" xmlns="http://test/schemas"

-Zafar
<bi*********@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Zafar,

Thanks for the response.

Can you give me an example of how to fix the problem? I did some
checking, and the term "targetNamespace" came up. I tried adding the
same targetNamespace to all child schemas without success. That is, I
added "targetNamespace="http://test/schemas"" to all the schemas. Is
there something else I need to do?

Thank you,

Andrew

Nov 12 '05 #4
Thanks Zafar!

That works.

Andrew

Nov 12 '05 #5

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

Similar topics

4
by: Group IIS | last post by:
Hi all, I am using ALTOVA XMLSpy. The start of my XML file looks like this: <?xml version="1.0" encoding="UTF-8" ?> <Submission xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
4
by: stiank81 | last post by:
Hi. I have a problem witch I assume there is an answear to....? I have several XML schemas, and they all have quiet a lot of definitions in common. They still have to be seperated into...
3
by: MR | last post by:
Is there a way to load an XML schema into a dataset from a resource or other object? I am using ReadXmlSchema(filename) and that works fine. However, I have many XSD files that I would rather not...
1
by: Wallace | last post by:
Hi all, I have a problem on validating a xml fragment using a single namespace schema which spread across multiple schema files using include in the master schema file. No matter how I change...
1
by: Buggyman | last post by:
Hi, I'm having trouble validating an intranet URL. I'm using the regular expresssion validator (though any ideas accepted), and using the standard Internet URL definition, which is.....
4
by: Jonas Bush | last post by:
I've got the some code to try and validate some xml. Against my schema, the "Good" xml (below) produces a couple of warnings, which I don't care about. The "Bad" xml (also below), produces warnings...
2
by: josh | last post by:
Hi, I am trying to validate cXML documents against cXML.dtd using the XmlValidatingReader. If I set the XMLValidatingReader's ValidatingType to ValidationType.DTD, I get the following...
3
by: jh3an | last post by:
Please give me your advice! I made two files according to xml book, but when validating these two files, it gives me an error that I totally don't understand. Is there a problem in these...
9
by: bowlderyu | last post by:
Hello, all. I meet a question about compiling files. Eg., I have three files named myfile.h, myfile.c and the main.c file, and there is a function, ex, void myfun(...). If I put myfun(...) in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.