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

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 2764
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.com> wrote in message
news:WZ******************@nwrddc02.gnilink.net...
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.com> wrote in message
news:WZ******************@nwrddc02.gnilink.net...
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="CustomerListSchema"
targetNamespace="http://tempuri.org/details"
attributeFormDefault="qualified"
xmlns="http://tempuri.org/details"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:typLib="http://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:simpleType name="postalCode">
<xs:restriction base="xs:positiveInteger">
<xs:pattern value="\d{5}" />
</xs:restriction>
</xs:simpleType>
<xs:complexType 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="postalCode" />
</xs:sequence>
</xs:complexType>
<xs:element name="customerList">
<xs:complexType>
<xs:sequence>
<xs:element name="customer">
<xs:complexType>
<xs:sequence>
<xs:element name="CompanyName" type="xs:string" />
<xs:element name="ContactName" type="xs:string" />
<xs:element name="Email" type="xs:string" />
<xs:element name="BillToAddress" type="usAddress" />
<xs:element name="ShipToAddress" type="usAddress" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="realPart" type="typLib:realPart" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
************************************************** ***************


"Priscilla Walmsley" <no****@datypic.com> wrote in message
news:eS**************@TK2MSFTNGP10.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.com> wrote in message
news:WZ******************@nwrddc02.gnilink.net...
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="CustomerListSchema"
targetNamespace="http://tempuri.org/details"
attributeFormDefault="qualified"
xmlns="http://tempuri.org/details"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:typLib="http://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:simpleType name="postalCode">
<xs:restriction base="xs:positiveInteger">
<xs:pattern value="\d{5}" />
</xs:restriction>
</xs:simpleType>
<xs:complexType 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="postalCode" />
</xs:sequence>
</xs:complexType>
<xs:element name="customerList">
<xs:complexType>
<xs:sequence>
<xs:element name="customer">
<xs:complexType>
<xs:sequence>
<xs:element name="CompanyName" type="xs:string" />
<xs:element name="ContactName" type="xs:string" />
<xs:element name="Email" type="xs:string" />
<xs:element name="BillToAddress" type="usAddress" />
<xs:element name="ShipToAddress" type="usAddress" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="realPart" type="typLib:realPart" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
************************************************** ***************


"Priscilla Walmsley" <no****@datypic.com> wrote in message
news:eS**************@TK2MSFTNGP10.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.com> wrote in message
news:WZ******************@nwrddc02.gnilink.net...
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.xsd) 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.xsd) 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****************@TK2MSFTNGP11.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.xsd) 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****************@TK2MSFTNGP11.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.xsd) 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
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...
2
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...
1
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...
3
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...
2
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...
3
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...
1
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...
0
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...
0
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.