473,545 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Importing XML Schema

Hi,
Can some one please help me with (or point me to) a very simple but
working code sample that shows how to import XML Schema.

I have tried many samples out there on internet but nothing seems to be
working. I am trying to import a complex type/simple type element type from
an external xml schema. I am using xs:import tag with namespace and
schemalocation attributes defined and have also declared xmlns relative to
this xml schema. I VS .NET I always get the error that "Type 'xxx' is not
declared."

TIA,
-P!
Nov 12 '05 #1
8 2784
Hi,

The examples from my book, Definitive XML Schema, are out at:

http://www.datypic.com/books/DefXMLSchema/Examples.html

The one that has to do with imports and includes is at:

http://www.datypic.com/books/DefXMLS...chapter04.html

That might help. If not, post a snippet of your schemas and maybe we can
tell you what's wrong.

Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------

"Poonam" <po****@none.co m> wrote in message
news:WZ******** **********@nwrd dc02.gnilink.ne t...
Hi,
Can some one please help me with (or point me to) a very simple but
working code sample that shows how to import XML Schema.

I have tried many samples out there on internet but nothing seems to be
working. I am trying to import a complex type/simple type element type from an external xml schema. I am using xs:import tag with namespace and
schemalocation attributes defined and have also declared xmlns relative to
this xml schema. I VS .NET I always get the error that "Type 'xxx' is not
declared."

TIA,
-P!

Nov 12 '05 #2
Hi,

The examples from my book, Definitive XML Schema, are out at:

http://www.datypic.com/books/DefXMLSchema/Examples.html

The one that has to do with imports and includes is at:

http://www.datypic.com/books/DefXMLS...chapter04.html

That might help. If not, post a snippet of your schemas and maybe we can
tell you what's wrong.

Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------

"Poonam" <po****@none.co m> wrote in message
news:WZ******** **********@nwrd dc02.gnilink.ne t...
Hi,
Can some one please help me with (or point me to) a very simple but
working code sample that shows how to import XML Schema.

I have tried many samples out there on internet but nothing seems to be
working. I am trying to import a complex type/simple type element type from an external xml schema. I am using xs:import tag with namespace and
schemalocation attributes defined and have also declared xmlns relative to
this xml schema. I VS .NET I always get the error that "Type 'xxx' is not
declared."

TIA,
-P!

Nov 12 '05 #3
Hi Priscilla,

Thank you very much for your response, i went through the sample code and
saw how Import was implemented.
I noticed that in those samples the xml schemas belong to same domain
(http://example.org) like
1)http://example.org/ord
2)http://example.org/pord
What I wanted to do is import some elements from XML schema that belongs to
different domain. I have attached my sample xml schema file.
I am pretty new to XML schemas , so forgive me if i am naive.
I refered to your book also, but couldn't see any example where we are
importing from different domains. I don't know whether this can be done or
not. But in my project i have the need to extend from some standard XML
Schemas.

I really appreciate your help.

Regards,
Poonam
************ code snippet******** *************** ******

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="CustomerLis tSchema"
targetNamespace ="http://tempuri.org/details"
attributeFormDe fault="qualifie d"
xmlns="http://tempuri.org/details"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:typLib="h ttp://www.w3.org/2001/03/XMLSchema/TypeLibrary">
<xs:import namespace="http ://www.w3.org/2001/03/XMLSchema/TypeLibrary"
schemaLocation= "http://www.w3.org/2001/03/XMLSchema/TypeLibrary.xsd " />
<xs:simpleTyp e name="postalCod e">
<xs:restricti on base="xs:positi veInteger">
<xs:pattern value="\d{5}" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="usAddress ">
<xs:sequence>
<xs:element name="name" type="xs:string " />
<xs:element name="Street" type="xs:string " />
<xs:element name="City" type="xs:string " />
<xs:element name="Zip" type="postalCod e" />
</xs:sequence>
</xs:complexType>
<xs:element name="customerL ist">
<xs:complexType >
<xs:sequence>
<xs:element name="customer" >
<xs:complexType >
<xs:sequence>
<xs:element name="CompanyNa me" type="xs:string " />
<xs:element name="ContactNa me" type="xs:string " />
<xs:element name="Email" type="xs:string " />
<xs:element name="BillToAdd ress" type="usAddress " />
<xs:element name="ShipToAdd ress" type="usAddress " />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="realPart" type="typLib:re alPart" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
*************** *************** *************** *************** *****


"Priscilla Walmsley" <no****@datypic .com> wrote in message
news:eS******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

The examples from my book, Definitive XML Schema, are out at:

http://www.datypic.com/books/DefXMLSchema/Examples.html

The one that has to do with imports and includes is at:

http://www.datypic.com/books/DefXMLS...chapter04.html

That might help. If not, post a snippet of your schemas and maybe we can
tell you what's wrong.

Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------

"Poonam" <po****@none.co m> wrote in message
news:WZ******** **********@nwrd dc02.gnilink.ne t...
Hi,
Can some one please help me with (or point me to) a very simple but
working code sample that shows how to import XML Schema.

I have tried many samples out there on internet but nothing seems to be
working. I am trying to import a complex type/simple type element type

from
an external xml schema. I am using xs:import tag with namespace and
schemalocation attributes defined and have also declared xmlns relative to this xml schema. I VS .NET I always get the error that "Type 'xxx' is not declared."

TIA,
-P!


Nov 12 '05 #4
Hi Priscilla,

Thank you very much for your response, i went through the sample code and
saw how Import was implemented.
I noticed that in those samples the xml schemas belong to same domain
(http://example.org) like
1)http://example.org/ord
2)http://example.org/pord
What I wanted to do is import some elements from XML schema that belongs to
different domain. I have attached my sample xml schema file.
I am pretty new to XML schemas , so forgive me if i am naive.
I refered to your book also, but couldn't see any example where we are
importing from different domains. I don't know whether this can be done or
not. But in my project i have the need to extend from some standard XML
Schemas.

I really appreciate your help.

Regards,
Poonam
************ code snippet******** *************** ******

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="CustomerLis tSchema"
targetNamespace ="http://tempuri.org/details"
attributeFormDe fault="qualifie d"
xmlns="http://tempuri.org/details"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:typLib="h ttp://www.w3.org/2001/03/XMLSchema/TypeLibrary">
<xs:import namespace="http ://www.w3.org/2001/03/XMLSchema/TypeLibrary"
schemaLocation= "http://www.w3.org/2001/03/XMLSchema/TypeLibrary.xsd " />
<xs:simpleTyp e name="postalCod e">
<xs:restricti on base="xs:positi veInteger">
<xs:pattern value="\d{5}" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="usAddress ">
<xs:sequence>
<xs:element name="name" type="xs:string " />
<xs:element name="Street" type="xs:string " />
<xs:element name="City" type="xs:string " />
<xs:element name="Zip" type="postalCod e" />
</xs:sequence>
</xs:complexType>
<xs:element name="customerL ist">
<xs:complexType >
<xs:sequence>
<xs:element name="customer" >
<xs:complexType >
<xs:sequence>
<xs:element name="CompanyNa me" type="xs:string " />
<xs:element name="ContactNa me" type="xs:string " />
<xs:element name="Email" type="xs:string " />
<xs:element name="BillToAdd ress" type="usAddress " />
<xs:element name="ShipToAdd ress" type="usAddress " />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="realPart" type="typLib:re alPart" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
*************** *************** *************** *************** *****


"Priscilla Walmsley" <no****@datypic .com> wrote in message
news:eS******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

The examples from my book, Definitive XML Schema, are out at:

http://www.datypic.com/books/DefXMLSchema/Examples.html

The one that has to do with imports and includes is at:

http://www.datypic.com/books/DefXMLS...chapter04.html

That might help. If not, post a snippet of your schemas and maybe we can
tell you what's wrong.

Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------

"Poonam" <po****@none.co m> wrote in message
news:WZ******** **********@nwrd dc02.gnilink.ne t...
Hi,
Can some one please help me with (or point me to) a very simple but
working code sample that shows how to import XML Schema.

I have tried many samples out there on internet but nothing seems to be
working. I am trying to import a complex type/simple type element type

from
an external xml schema. I am using xs:import tag with namespace and
schemalocation attributes defined and have also declared xmlns relative to this xml schema. I VS .NET I always get the error that "Type 'xxx' is not declared."

TIA,
-P!


Nov 12 '05 #5
Hi,

Namespace names are just strings, so the "domain name" in them does not
matter. Importing schemas from a different domain works exactly the same
way as importing schemas in the same domain.

I don't see anything wrong with your schema. It is somewhat complex, since
the imported schema document (TypeLibrary.xs d) includes another schema
document (TypeLibrary-math.xsd), which then includes another schema document
(TypeLibrary-nn-math.xsd).

The third schema document does not have a target namespace, but it should
take on the namespace you have specified
(http://www.w3.org/2001/03/XMLSchema/TypeLibrary) because it is included in
one that does. This is commonly known as a "chameleon include".

I would guess the processor is having a hard time either with (1) the
relative references to other schema documents in the xs:include elements in
the imported schemas, or (2) not implementing the chameleon include
correctly.

Maybe someone who is more familiar with the Microsoft processor can shed
some light?

Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------
Nov 12 '05 #6
Hi,

Namespace names are just strings, so the "domain name" in them does not
matter. Importing schemas from a different domain works exactly the same
way as importing schemas in the same domain.

I don't see anything wrong with your schema. It is somewhat complex, since
the imported schema document (TypeLibrary.xs d) includes another schema
document (TypeLibrary-math.xsd), which then includes another schema document
(TypeLibrary-nn-math.xsd).

The third schema document does not have a target namespace, but it should
take on the namespace you have specified
(http://www.w3.org/2001/03/XMLSchema/TypeLibrary) because it is included in
one that does. This is commonly known as a "chameleon include".

I would guess the processor is having a hard time either with (1) the
relative references to other schema documents in the xs:include elements in
the imported schemas, or (2) not implementing the chameleon include
correctly.

Maybe someone who is more familiar with the Microsoft processor can shed
some light?

Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------
Nov 12 '05 #7
Chameleon Includes are not supported by .NET Framework 1.0 / 1.1. To get
this to work, you will have to add a targetNamespace to the schema that you
are including as a chameleon.

Thanks,
Priya

"Priscilla Walmsley" <no****@datypic .com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi,

Namespace names are just strings, so the "domain name" in them does not
matter. Importing schemas from a different domain works exactly the same
way as importing schemas in the same domain.

I don't see anything wrong with your schema. It is somewhat complex, since the imported schema document (TypeLibrary.xs d) includes another schema
document (TypeLibrary-math.xsd), which then includes another schema document (TypeLibrary-nn-math.xsd).

The third schema document does not have a target namespace, but it should
take on the namespace you have specified
(http://www.w3.org/2001/03/XMLSchema/TypeLibrary) because it is included in one that does. This is commonly known as a "chameleon include".

I would guess the processor is having a hard time either with (1) the
relative references to other schema documents in the xs:include elements in the imported schemas, or (2) not implementing the chameleon include
correctly.

Maybe someone who is more familiar with the Microsoft processor can shed
some light?

Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------

Nov 12 '05 #8
Chameleon Includes are not supported by .NET Framework 1.0 / 1.1. To get
this to work, you will have to add a targetNamespace to the schema that you
are including as a chameleon.

Thanks,
Priya

"Priscilla Walmsley" <no****@datypic .com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi,

Namespace names are just strings, so the "domain name" in them does not
matter. Importing schemas from a different domain works exactly the same
way as importing schemas in the same domain.

I don't see anything wrong with your schema. It is somewhat complex, since the imported schema document (TypeLibrary.xs d) includes another schema
document (TypeLibrary-math.xsd), which then includes another schema document (TypeLibrary-nn-math.xsd).

The third schema document does not have a target namespace, but it should
take on the namespace you have specified
(http://www.w3.org/2001/03/XMLSchema/TypeLibrary) because it is included in one that does. This is commonly known as a "chameleon include".

I would guess the processor is having a hard time either with (1) the
relative references to other schema documents in the xs:include elements in the imported schemas, or (2) not implementing the chameleon include
correctly.

Maybe someone who is more familiar with the Microsoft processor can shed
some light?

Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------

Nov 12 '05 #9

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

Similar topics

0
1595
by: Michael | last post by:
I apologize if this might be a beginner question, which is clear to the experts. But I could not find a clear answer yet. I have extracted a schema / user with the exp utility. I want to import it into a schema / user of a different Oracle server. Tables structures etc. are more or less the same. However, there are a few ADDITIONAL COLUMNS...
2
2426
by: Fezboy | last post by:
Greetings! I'm trying to import elements declared in the METS and MODS XML Schema into my own. I've gotten to the point where the xsd validates, but when I try to validate a document against it, it expects element '' in place of mets:fileGrp. The same error obtains for mets:structMap if I comment out the mets:fileGrp code. Can an...
1
2217
by: Steve George | last post by:
Hi, I have a scenario where I have a master schema that defines a number of complex and simple types. I then have a number of other schemas (with different namespaces) where I would like to reuse some of these master complex and simple types. This I believe will assist me in transforming between the master schema and the other smaller schemas...
3
1851
by: farseer | last post by:
Hello, i have a schema which also imports the XHTML schema: <xsd:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"/> This schema validates fine in XMLSpy and in VS2005. However, in Visual Studio 2005 beta2, when i attempt to reference this schema from "Templates and...
2
7288
by: Ali | last post by:
I am having problem compiling schema contained in WSDL file when analyzing schema types contained in it (for example http://www.ebout.net/net/GoogleSearch.wsdl). Following code demonstrates my problem: using System.Diagnostics; using System.IO; using System.Xml; using System.Xml.Schema;
3
3708
by: Sam Alexander | last post by:
Hi Everone, I'm writing a script to import data from an XML file, and this tutorial is really an awesome guide : http://www.kbalertz.com/Q316005/Import.Server.Component.aspx ... problem though is here's a snippet of my XML file: <planets> <sun rise="6:23" set="20:33"/> <moon rise="18:54" set="4:26"/>
1
1717
by: Arndt Jonasson | last post by:
Let's say an XML Schema schema A uses types from another schema B. Then, if I understand things correctly, A needs to import schema B (maybe "importing its namespace" is more correctly put). It is also allowed for both A and B to import the XML Schema namespace, but at least when I use the xmllint validator, it isn't necessary. My question...
0
1073
by: =?Utf-8?B?RmlsaXBwbyBCZXR0aW5hZ2xpbw==?= | last post by:
I am trying to use a web service that publishes a WSDL with external schema (.XSD files), unfortunately the .NET wsdl.exe is not able to generate the proxy class for it. It seems that wsdl.exe do not support external schemas. What can I do? 1. I asked them to change the WSDL including the external schema no way… 2. Is there any other...
0
1642
by: JimP | last post by:
I'm importing XML files into a SQLExpress DB using SQLXML and VB.net 2005. I have a simple *.xsd schema file that is pulling in all attributes from the <Activityelement. It also has a <Headerelement that I'd like to add the 'Run' attribute for each record in the TA_HeaderID field. So, in the example, '879" would be added to each record in...
0
7428
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...
0
7685
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. ...
1
7452
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...
0
7784
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...
0
6014
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...
0
5071
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3485
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1916
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.