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

putting together 2 XSD

Xh
Hi All!

I have two simple XSD files

they are used for elements: <patientand <address>

as standalone XML schemas - they work perfectly - validated with:
http://validate.openlaboratory.net/

I tried to put them together but they don't work.

I got errors with element <address- maybe I'm missing something
or my XML document is invalid in a way I don't see or understand?

I got message: Element 'address' is not valid for content model:
'((lastName,birthDate),address)'

My document looks like this:

<p:patient xmlns:p="http://test/patient" xmlns:a="http://test/
address">
<p:lastName>test</p:lastName><p:birthDate>1983-03-07</p:birthDate>
<a:address>
<a:postalCode>01-111</a:postalCode>
<a:city>Wasas</a:city>
<a:street>dsdsd</a:street>
<a:country>Poland</a:country>
</a:address>
</p:patient>

This is for patient:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test/patient"
xmlns="http://test/patient"
xmlns:addr="http://test/address"
elementFormDefault="qualified">
<xs:import namespace="http://test/address"/>
<xs:element name="patient" type="patientType"/>
<xs:element name="lastName" type="xs:string"/>
<xs:element name="birthDate" type="xs:date"/>
<xs:element name="address" type="addr:addressType"/>
<xs:complexType name="patientType">
<xs:sequence>
<xs:element ref="lastName"/>
<xs:element ref="birthDate"/>
<xs:element ref="address"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

and this is finally the address.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test/address"
xmlns="http://test/address">
<xs:element name="address" type="addressType"/>
<xs:element name="postalCode" type="postalCodeType"/>
<xs:element name="city" type="stringMinLenght3"/>
<xs:element name="street" type="stringMinLenght3"/>
<xs:element name="country" type="stringMinLenght3"/>
<xs:simpleType name="stringMinLenght3">
<xs:restriction base="xs:string">
<xs:minLength value="3"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="postalCodeType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{2}-[0-9]{3}"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="addressType">
<xs:sequence>
<xs:element ref="postalCode"/>
<xs:element ref="city"/>
<xs:element ref="street"/>
<xs:element ref="country"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

thanks in advance for any tips and hints

best regards
Ɓukasz

Mar 21 '07 #1
1 1345
On Mar 21, 4:35 am, "Xh"
<lukasz.bud...@komputery-internet.netwrote:
I have two simple XSD files
they are used for elements: <patientand <address>

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test/patient"
xmlns="http://test/patient"
xmlns:addr="http://test/address"
elementFormDefault="qualified">
<xs:import namespace="http://test/address"/>
You seem to be missing something here (and that something
seems to be the schemaLocation attribute).
<xs:element name="patient" type="patientType"/>
<xs:element name="lastName" type="xs:string"/>
<xs:element name="birthDate" type="xs:date"/>
<xs:element name="address" type="addr:addressType"/>
Absolutely no reason to do this.
<xs:complexType name="patientType">
<xs:sequence>
<xs:element ref="lastName"/>
<xs:element ref="birthDate"/>
<xs:element ref="address"/>
<xs:element ref="addr:address"/>, since you're trying to
import it anyway.
</xs:sequence>
</xs:complexType>
</xs:schema>
There might be other problems with your schemata, too, but
this should solve your immediate problem.

--
Pavel Lepin

Mar 21 '07 #2

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

Similar topics

2
by: Piet | last post by:
Hello, I have a short question about sizers and how they work when I have a frame or panel with a complex sizer hierarchie. When creating a new sizer which sits itself in its parent sizer, should...
4
by: Toby A Inkster | last post by:
In "the other place" Jukka has pointed out that semantically <blockquote/> is useless in many browsers, so I'm experimenting with Javascript to put some functionality back into <blockquote/>. ...
1
by: Christopher M. Lusardi | last post by:
Hello, I have a program that can be compiled and run on SGI and Linux computers, and only one of the files in the program has is different. On the SGI system, the file has a dot capital C...
2
by: Harlin Seritt | last post by:
I have a file that a few different running scripts will need to access. Most likely this won't be a problem but if it is, what do I need to do to make sure scripts don't crash because the input...
17
by: Rebecca | last post by:
I have a large Access 97 database that's been split into a front and back end. We've used it successfully with several computers networked together, but now some of the people in my organization...
1
by: Grim Reaper | last post by:
I asked this question, earlier, and received an answer that I am not sure about how to do. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types...
0
by: Jessica | last post by:
Hi, I am new to C++ .Net so please forgive me if the question sounds silly. I have implemented a class, as well as some client code that uses the class. Now I decided that I want to add a GUI...
2
by: UJ | last post by:
I am making an executable that has lots of graphics. I'd like to keep the graphics together in a subdirectory. I can figure out how to make a link to the file in Visual Studio but how do I tell it...
4
by: theravenproject | last post by:
I am just getting into learning to program with C/C++, I am trying to put together all of the applications I will need to write programs and execute them all on my cpu-I am using windows xp home...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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,...
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...
0
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...

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.