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

Using xs:import and xs:extension

I'm having problems getting an XML document to validate against a
fairly complex scenario.

Goals:
-To have two schemas with two different namespaces, so that I can
validate each one seperately against an XML doc. Hence why I'm using
xs:import instead of xs:include.
-To create some sample XML that will validate in Visual Studio and I
can use the tools there to enter in the XML data.

Here is the "base" schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="BaseSchema" targetNamespace="http://tempuri.org/Program"
elementFormDefault="qualified" xmlns="http://tempuri.org/Program"
xmlns:mstns="http://tempuri.org/Program"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="BaseElement" type="BaseComplexType">
</xs:element>
<xs:complexType name="BaseComplexType">
<xs:sequence>
<xs:element name="Primary" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:schema>

Here is the sub schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="SubSchema"
targetNamespace="http://tempuri.org/ProgramSub"
elementFormDefault="qualified" xmlns="http://tempuri.org/ProgramSub"
xmlns:mstns="http://tempuri.org/ProgramSub"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bs="http://tempuri.org/Program"
xmlns:ss="http://tempuri.org/ProgramSub">
<xs:import schemaLocation="BaseSchema.xsd"
namespace="http://tempuri.org/Program"></xs:import>
<xs:element name="SubElement" type="SubComplexType">
</xs:element>
<xs:complexType name="SubComplexType">
<xs:complexContent>
<xs:extension base="bs:BaseComplexType">
<xs:sequence>
<xs:element name="ExtraString" type="xs:string" />
<xs:element name="Foo" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

Both of these seem to validate fine. When I create a new XML document
using VS, the data entry tools work fine and it generates:
<?xml version="1.0" encoding="utf-8"?>
<SubElement xmlns="http://tempuri.org/ProgramSub">
<Primary xmlns="http://tempuri.org/Program">1</Primary>
<ExtraString>sad</ExtraString>
<Foo>asdfasd</Foo>
</SubElement>

But it gives me the validation error of:
C:\Projects\Miscellaneous\Prototypes\ProgramManage ment\Test.xml(3): The
active schema does not support the element 'Primary'.

So I tried to put namespaces in:
<?xml version="1.0" encoding="utf-8"?>
<ss:SubElement xmlns:ss="http://tempuri.org/ProgramSub"
xmlns:bs="http://tempuri.org/Program">
<bs:Primary>1</bs:Primary>
<ss:ExtraString>sd</ss:ExtraString>
<ss:Foo>sad</ss:Foo>
</ss:SubElement>

But still no luck.
C:\Projects\Miscellaneous\Prototypes\ProgramManage ment\SubData.xml(3):
The active schema does not support the element 'bs:Primary'.

Anybody have an idea?

Jan 17 '06 #1
2 1900
Works for me.

That is, I can validate your instance with your schema docs just fine,
using XSV.

Sounds like a VS bug.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Jan 17 '06 #2
VS2005 validates it as well.

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Henry S. Thompson" <ht@inf.ed.ac.uk> wrote in message
news:f5*************@erasmus.inf.ed.ac.uk...
Works for me.

That is, I can validate your instance with your schema docs just fine,
using XSV.

Sounds like a VS bug.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged
spam]

Jan 17 '06 #3

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

Similar topics

2
by: Charles Fineman | last post by:
Say i've got a type that appears in a request... say it represents a shipment. I want it to contain things like from and to address elements as well as a sequence of the pieces being shipped. ...
4
by: Lénaïc Huard | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I've some namespace problems when defining default values for attributes. My problem seems to come from the fact that the attributes are...
0
by: jlea | last post by:
I using anyAttribute in a base class and this is causing problems in a derived class. I then use xsd to generate C# classes that serialize and deserialze XML. The following schema is what I'm...
1
by: John Smith | last post by:
Ok, I have 2 xml files that are really similar. They have the exact same structure exept that in one XML some element are required and in the other they are simply absent from the xml. Problem...
3
by: sachinvyas | last post by:
Hi, I have following schema saved in new.xsd <?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="http://www.smpte-ra.org/schemas/429.7/2006/CPL"...
0
by: SL33PY | last post by:
Hi again, I feel like I'm spamming the place, but these are all the things that I encounter during work. Anyways: I made a base complex type: <xs:complexType name="BaseLocationType">...
5
by: Pete Wittig | last post by:
Hi, Here is my problem. I have a serviced component that is exposed via a SOAP interface. This particular component, Person, has a method that takes in another object called PersonHobby. When...
4
by: IsValidUN | last post by:
I have an XSD which has an import to an XSD located on the web which has a DTD within it. (Using VS-2005 2.0 framework) If I load the XSD using the following, it can't find elements defined within...
0
by: RC | last post by:
Please see the example below. What is/are the difference(s) between xs:group and xs:extension <xs:complexType name="personinfo"> <xs:sequence> <xs:element name="firstname" type="xs:string"/>...
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: 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
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
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...
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.