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

on XML Schema

Hey there,

I have a question concerning xml schemas and its contained elements.
Let's say I have a schema (object.xsd) that defines an abstract element
type (i.e. abstractObject). Dervied from this type are concrete types
(i.e. house, car...).
Now, I have an xml document that expects information about a datatype
in xml schema format. How can I now define that it is supposed to
expect an element of type "house"? Of course I can just refer to
"object.xsd". But that would mean that entries of type "car" would be
accepted as well. What possibilities do I have to restrict the schema
definition to the type "house"?

Thanks in advance,
Thorsten

Jan 19 '07 #1
5 1200
Thorsten wrote:
Hey there,

I have a question concerning xml schemas and its contained elements.
Let's say I have a schema (object.xsd) that defines an abstract element
type (i.e. abstractObject). Dervied from this type are concrete types
(i.e. house, car...).
Now, I have an xml document that expects information about a datatype
in xml schema format. How can I now define that it is supposed to
expect an element of type "house"?
Well in the schema you would use
<xs:element name="someName" type="house"/>
to define an element of the house type. Then an XML instance document to
be validated against the schema needs to have an element of type house.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 19 '07 #2
Hi Thorsten,

It is not very clear for me what you want exactly. In addition to
Martin's answer: if you have an element of type abstractObject then in
the instance document you can use the xsi:type attribute to specify the
type to house for instance, where xsi maps to the schema instance
namespace: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Thorsten wrote:
Hey there,

I have a question concerning xml schemas and its contained elements.
Let's say I have a schema (object.xsd) that defines an abstract element
type (i.e. abstractObject). Dervied from this type are concrete types
(i.e. house, car...).
Now, I have an xml document that expects information about a datatype
in xml schema format. How can I now define that it is supposed to
expect an element of type "house"? Of course I can just refer to
"object.xsd". But that would mean that entries of type "car" would be
accepted as well. What possibilities do I have to restrict the schema
definition to the type "house"?

Thanks in advance,
Thorsten
Jan 19 '07 #3
Thanks to both of you.

I think George's advice might help me. To clearify my problem: I work
with web services and one of them awaits a URL, where the data to
process is deposited. In addition it expects a reference to a schema
which describes the data structure of the data to process. Back to my
example: let's say I want the web service to process a data of type
"house" i have to post the URL to the house object and I have to
specify the schema for "house". All I can do is specify
"..../object.xsd" but to me that is too general, because the web
service would then accept all other objects defined in "objects.xsd",
but might not be able to process them.

Hope that's more understandable,
regards,
Thorsten

Jan 19 '07 #4
Thorsten wrote:
I think George's advice might help me. To clearify my problem: I work
with web services and one of them awaits a URL, where the data to
process is deposited. In addition it expects a reference to a schema
which describes the data structure of the data to process. Back to my
example: let's say I want the web service to process a data of type
"house" i have to post the URL to the house object and I have to
specify the schema for "house". All I can do is specify
"..../object.xsd" but to me that is too general, because the web
service would then accept all other objects defined in "objects.xsd",
but might not be able to process them.
A schema can define types but it can also define elements and usually
does. So you would define a schema that defines an element of that house
type.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 19 '07 #5
Ok, that's what I'll do.
I thought that there is maybe another way than creating a new schema
for the subtype

Thanks a lot for you help guys!
Thorsten

Jan 19 '07 #6

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

Similar topics

2
by: wooks | last post by:
<?xml version='1.0'?> <userlogin xmlns="urn:faster:userlogin" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <login>mick</login> <password>brown</password> </userlogin> Above is my...
0
by: C. M. Sperberg-McQueen | last post by:
wooks (wookiz@hotmail.com) wrote: > <?xml version='1.0'?> > <userlogin xmlns="urn:faster:userlogin" > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> > <login>mick</login> > ...
6
by: Pieter | last post by:
I've read a lot of posts on "why relax ng is so very good" and on "why w3c xml schema should be the only schema language". I'm, however, still not clear on why I should prefer one over the other. ...
1
by: Hari Om | last post by:
Subject: XML Schema to XML Schema Conversion I have an XML Schema A which needs to mapped to another XML Schema B. Is there any handy tool which I could use to convert from Schema A to Schema B?...
4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
2
by: Stanimir Stamenkov | last post by:
I'm trying to find out if it is permissible to include a schema document with absent target namespace to a schema with specified target namespace, and if it is, what are the rules to resolve the...
0
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
0
by: Derek | last post by:
I am creating an intranet using Visual Web Developer Express Edition. Everything has been working OK until yesterday when I started getting 62 messages all beginning "Could not find schema...
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
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.