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

XmlSchema include question.

Hello,

I have 2 schema, for argument sake let's call them child.xsd and parent.xsd.
I define all my types in parent.xsd and the child.xsd include the parent.xsd
using the following tag:

<xs:include schemaLocation="http://localhost/xsds/parent.xsd"/>

Now when I create an XmlSchema object on the child.xsd I couldn't get the
type that I define in the parent.xsd. How do I get this? Do I need to create
an XmlSchema on the parent.xsd itself? Why doesn't the xs:include includes
the parent.xsd?

I tried to loop through the .Include property, I have 1 element there -
which is right - but then the SourceUri is empty ...

Thanks,

Nathan
Nov 12 '05 #1
3 2781
Please post the two XSD files and the code you are using.

Thanks.

"Nathan Wallace" <sy***@nospam.nospam> wrote in message
news:28**********************************@microsof t.com...
Hello,

I have 2 schema, for argument sake let's call them child.xsd and parent.xsd. I define all my types in parent.xsd and the child.xsd include the parent.xsd using the following tag:

<xs:include schemaLocation="http://localhost/xsds/parent.xsd"/>

Now when I create an XmlSchema object on the child.xsd I couldn't get the
type that I define in the parent.xsd. How do I get this? Do I need to create an XmlSchema on the parent.xsd itself? Why doesn't the xs:include includes
the parent.xsd?

I tried to loop through the .Include property, I have 1 element there -
which is right - but then the SourceUri is empty ...

Thanks,

Nathan

Nov 12 '05 #2
Well it's simple:

File 1:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sauce="http://www.synop.com/sauce/1.0" elementFormDefault="qualified"
attributeFormDefault="qualified">
<xs:include schemaLocation="http://victor/sauce.xsd"/>
<xs:element name="topic">
<xs:annotation>
<xs:documentation>Defines a topic.</xs:documentation>
<xs:appinfo>
<sauce:name>Topic
</sauce:name>
</xs:appinfo>
</xs:annotation>
<xs:complexType mixed="false">
<xs:sequence>
<xs:element name="title"/>
<xs:element name="body"/>
</xs:sequence>
<xs:anyAttribute namespace="##any"/>
</xs:complexType>
</xs:element>
</xs:schema>

While the second file (sauce.xsd) is:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sauce="http://www.synop.com/sauce/1.0" elementFormDefault="qualified">
<xs:simpleType name="mediumString">
<xs:annotation>
<xs:documentation>A string</xs:documentation>
</xs:annotation>
<xs:restriction>
<xs:minLength value="1"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
"Zafar Abbas [MSFT]" wrote:
Please post the two XSD files and the code you are using.

Thanks.

"Nathan Wallace" <sy***@nospam.nospam> wrote in message
news:28**********************************@microsof t.com...
Hello,

I have 2 schema, for argument sake let's call them child.xsd and

parent.xsd.
I define all my types in parent.xsd and the child.xsd include the

parent.xsd
using the following tag:

<xs:include schemaLocation="http://localhost/xsds/parent.xsd"/>

Now when I create an XmlSchema object on the child.xsd I couldn't get the
type that I define in the parent.xsd. How do I get this? Do I need to

create
an XmlSchema on the parent.xsd itself? Why doesn't the xs:include includes
the parent.xsd?

I tried to loop through the .Include property, I have 1 element there -
which is right - but then the SourceUri is empty ...

Thanks,

Nathan


Nov 12 '05 #3
Your second schema, sauce.xsd is invalid. Did you load file1 into an
XmlSchema and called Compile(). It should have reported an error.
The corrected sauce.xsd is:

<xs:simpleType name="mediumString">
<xs:annotation>
<xs:documentation>A string</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
"Victor Hadianto" <sy***@nospam.nospam> wrote in message
news:A7**********************************@microsof t.com...
Well it's simple:

File 1:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sauce="http://www.synop.com/sauce/1.0" elementFormDefault="qualified" attributeFormDefault="qualified">
<xs:include schemaLocation="http://victor/sauce.xsd"/>
<xs:element name="topic">
<xs:annotation>
<xs:documentation>Defines a topic.</xs:documentation>
<xs:appinfo>
<sauce:name>Topic
</sauce:name>
</xs:appinfo>
</xs:annotation>
<xs:complexType mixed="false">
<xs:sequence>
<xs:element name="title"/>
<xs:element name="body"/>
</xs:sequence>
<xs:anyAttribute namespace="##any"/>
</xs:complexType>
</xs:element>
</xs:schema>

While the second file (sauce.xsd) is:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sauce="http://www.synop.com/sauce/1.0" elementFormDefault="qualified"> <xs:simpleType name="mediumString">
<xs:annotation>
<xs:documentation>A string</xs:documentation>
</xs:annotation>
<xs:restriction>
<xs:minLength value="1"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
"Zafar Abbas [MSFT]" wrote:
Please post the two XSD files and the code you are using.

Thanks.

"Nathan Wallace" <sy***@nospam.nospam> wrote in message
news:28**********************************@microsof t.com...
Hello,

I have 2 schema, for argument sake let's call them child.xsd and

parent.xsd.
I define all my types in parent.xsd and the child.xsd include the

parent.xsd
using the following tag:

<xs:include schemaLocation="http://localhost/xsds/parent.xsd"/>

Now when I create an XmlSchema object on the child.xsd I couldn't get the type that I define in the parent.xsd. How do I get this? Do I need to

create
an XmlSchema on the parent.xsd itself? Why doesn't the xs:include includes the parent.xsd?

I tried to loop through the .Include property, I have 1 element there - which is right - but then the SourceUri is empty ...

Thanks,

Nathan


Nov 12 '05 #4

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

Similar topics

0
by: BODIN | last post by:
I have an XML document, which is actually physically stored in 2 separated files. doc1.xml and doc2.xml I NEED a WAY FOR THIS SIMPLE NEED : XML file splitted into two physical files, and use...
1
by: Fred Smith | last post by:
Any suggestions or tips to the questions below I have been wrestling with would be most welcome: I have an example XSD file I have been experimenting with. Suppose a user can select from 1 to 4...
2
by: AlexS | last post by:
Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any...
2
by: Alex Shirshov | last post by:
Hello, All! It seems the bug (http://groups.google.com/groups?hl=ru&lr=&ie=UTF-8&threadm=a53b01c28a00%242 08bc860%2439ef2ecf%40TKMSFTNGXA08&rnum=8&prev=/groups%3Fq%3DschemaLocation%2...
1
by: Victor Hadianto | last post by:
Hi, I have a simple XSD for example like this: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified">...
1
by: qdm | last post by:
Below is a snippet that I'm sure is quite familiar to most ... <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" Here, I've given the XMLSchema namespace the prefix 'xsd', and with...
0
by: John | last post by:
Hi, I'm creating a component to generate a schema file much like VS generates for DataSets. I'm using XmlSchema to do the job and I also am using a XmlNamespaceManager to manage namespaces. ...
4
by: Igor Koretsky | last post by:
Hi. Using VB.Net System.Xml 1.0 SchemaCollection Object I am getting an error when trying to add ‘Schema A’ to the SchemaCollection. Here are my schema files..
2
by: doughboy | last post by:
I create a schema in memory and then I can write to a file fine. But as soon as I add an import element I get an error when it goes to write to the file. The error message is: The type...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.