473,834 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_dataType s.xsd in the
main schema AND I include it in common_PointRec ord.xsd
which is itself included in RecordOfInteres t.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" elementFormDefa ult="qualified" >
<xsd:include schemaLocation= "Common_dataTyp es.xsd"/>
<xsd:include schemaLocation= "RecordOfIntere st.xsd"/>
<xsd:element name="PRIMARY_Q UERY">
<xsd:complexTyp e>
<xsd:all>
<xsd:element name="Id" type="standardI dentifierType"/>
<xsd:element name="RecordOfI nterestobj" type="RecordOfI nterest"
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"
elementFormDefa ult="qualified" >
<xsd:simpleTy pe name="XType">
<xsd:restrictio n base="xsd:doubl e">
<xsd:minInclusi ve value="-10.0"/>
<xsd:maxInclusi ve value="10.0"/>
</xsd:restriction >
</xsd:simpleType>
<xsd:simpleTy pe name="YType">
<xsd:restrictio n base="xsd:doubl e">
<xsd:minInclusi ve value="-18.0"/>
<xsd:maxInclusi ve value="18.0"/>
</xsd:restriction >
</xsd:simpleType>
<xsd:simpleTy pe name="standardI dentifierType">
<xsd:restrictio n base="xsd:token ">
<xsd:maxLengt h value="128"/>
<xsd:minLengt h value="1"/>
<xsd:pattern value="[0-9A-Za-z_\.\-]+"/>
</xsd:restriction >
</xsd:simpleType>
</xsd:schema>
RecordOfInteres t.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" elementFormDefa ult="qualified" >
<xsd:include schemaLocation= "common_PointRe cord.xsd"/>
<xsd:complexTyp e name="RecordOfI nterest">
<xsd:all>
<xsd:element name="DATA">
<xsd:complexTyp e>
<xsd:sequence >
<xsd:element name="TempData" type="PointReco rd" minOccurs="3"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:complexType >
</xsd:element>
</xsd:all>
</xsd:complexType >
</xsd:schema>

common_PointRec ord.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" >
<xsd:include schemaLocation= "Common_dataTyp es.xsd"/>
<xsd:complexTyp e name="PointReco rd">
<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 2297
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*********@ya hoo.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.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_dataType s.xsd in the
main schema AND I include it in common_PointRec ord.xsd
which is itself included in RecordOfInteres t.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" elementFormDefa ult="qualified" >
<xsd:include schemaLocation= "Common_dataTyp es.xsd"/>
<xsd:include schemaLocation= "RecordOfIntere st.xsd"/>
<xsd:element name="PRIMARY_Q UERY">
<xsd:complexTyp e>
<xsd:all>
<xsd:element name="Id" type="standardI dentifierType"/>
<xsd:element name="RecordOfI nterestobj" type="RecordOfI nterest"
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"
elementFormDefa ult="qualified" >
<xsd:simpleTy pe name="XType">
<xsd:restrictio n base="xsd:doubl e">
<xsd:minInclusi ve value="-10.0"/>
<xsd:maxInclusi ve value="10.0"/>
</xsd:restriction >
</xsd:simpleType>
<xsd:simpleTy pe name="YType">
<xsd:restrictio n base="xsd:doubl e">
<xsd:minInclusi ve value="-18.0"/>
<xsd:maxInclusi ve value="18.0"/>
</xsd:restriction >
</xsd:simpleType>
<xsd:simpleTy pe name="standardI dentifierType">
<xsd:restrictio n base="xsd:token ">
<xsd:maxLengt h value="128"/>
<xsd:minLengt h value="1"/>
<xsd:pattern value="[0-9A-Za-z_\.\-]+"/>
</xsd:restriction >
</xsd:simpleType>
</xsd:schema>
RecordOfInteres t.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" elementFormDefa ult="qualified" >
<xsd:include schemaLocation= "common_PointRe cord.xsd"/>
<xsd:complexTyp e name="RecordOfI nterest">
<xsd:all>
<xsd:element name="DATA">
<xsd:complexTyp e>
<xsd:sequence >
<xsd:element name="TempData" type="PointReco rd" minOccurs="3"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:complexType >
</xsd:element>
</xsd:all>
</xsd:complexType >
</xsd:schema>

common_PointRec ord.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" >
<xsd:include schemaLocation= "Common_dataTyp es.xsd"/>
<xsd:complexTyp e name="PointReco rd">
<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 "targetNamespac e" came up. I tried adding the
same targetNamespace to all child schemas without success. That is, I
added "targetNamespac e="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_PointRec ord.xsd schema.

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

-Zafar
<bi*********@ya hoo.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.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 "targetNamespac e" came up. I tried adding the
same targetNamespace to all child schemas without success. That is, I
added "targetNamespac e="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
2492
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" xsi:noNamespaceSchemaLocation="layout.xsd"> When I go to validate my XML file it give me error "This file is not
4
2648
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 different XML schemas, but what I want to do is to create one XML schema containing all the common definitions (this is mostly type definitions). I then want all the XML schemas I have to include this file containing the definitions.
3
5624
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 have to distribute with the application. I would like to be able to use a typed dataset since the schema is defined in advance. Is this possible? thanks
1
2319
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 the xml fragment (to include default namespace xmlns='urn:xxx:yy' and any other namespace it may have), I still get the same error. 'urn:xxx:yy:Header' element is not declared. An error occurred at , (1, 2).
1
1410
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.. http://(+\.)++(/*)? unfortunately this doesn't work with our intranet values, such as (e.g.) http://homer/wibble/viewDocument.aspx?Data=1789
4
1743
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 as well, but *should* be producing errors. The XML validator at http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx reports that the "Good" xml produces warnings, but the "bad" xml produces errors, which is what I want to reproduce in...
2
7189
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 System.Xml.Schema.XmlSchemaException: "The parameter entity replacement text must nest properly within markup
3
3645
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 codes? I checked xml and schema files through these following sites: http://tools.decisionsoft.com/schemaValidate/
9
1589
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 the main.c file like the following, ..... void myfun(...) {
0
9799
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9646
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10793
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10219
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7758
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5794
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.