473,326 Members | 2,111 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,326 software developers and data experts.

Restricting the behaviour of an imported complexType

I want to import a complex type into my schema which contains a complex
type which includes a choice as shown below:

<choice minOccurs="2" maxOccurs="unbounded">
<element ref="gml:pos"/>
<element ref="gml:pointProperty"/>
<element ref="gml:pointRep">
</choice>

Howver, in my schema I only want to allow the "gml:pos" element to
occur, not the others. Is it possible to restrict the allowable
instances of the imported complexType within my schema? I know I could
just reference the gml:pos element directly but I was wondering if it
is possible to import the complex type and then restrict the values?

Thanks

Steve

Mar 2 '06 #1
4 1043


steve_marjoribanks wrote:
I want to import a complex type into my schema which contains a complex
type which includes a choice as shown below:

<choice minOccurs="2" maxOccurs="unbounded">
<element ref="gml:pos"/>
<element ref="gml:pointProperty"/>
<element ref="gml:pointRep">
</choice>

Howver, in my schema I only want to allow the "gml:pos" element to
occur, not the others. Is it possible to restrict the allowable
instances of the imported complexType within my schema? I know I could
just reference the gml:pos element directly but I was wondering if it
is possible to import the complex type and then restrict the values?


Generally you can extend and restrict existing types, see
<http://www.w3.org/TR/xmlschema-0/#DerivByRestrict>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 2 '06 #2
I've tried that but it doesn't seem to like it. I created my complex
type and derived it from an existing type. When I had my type exaclt
the same as the existing type it validated fine and when I tried
changing the maxOccurs attribute of elements in my complex type which
were derived from the existing type that was fine too.

However, whenever I tried to remove elements from my type or setting
maxOccurs and minOccurs to 0 it doesn't like it.

In the W3C recommendation it says this should be ok though?!

Ah well, I just referenced gml:pos directly in the end. Thanks anyhow!

Mar 2 '06 #3
steve_marjoribanks writes:
I've tried that but it doesn't seem to like it. I created my complex
type and derived it from an existing type. When I had my type exaclt
the same as the existing type it validated fine and when I tried
changing the maxOccurs attribute of elements in my complex type which
were derived from the existing type that was fine too.

However, whenever I tried to remove elements from my type or setting
maxOccurs and minOccurs to 0 it doesn't like it.

In the W3C recommendation it says this should be ok though?!


Indeed it is OK -- what schema processor are you using, and what error
message are you getting, for what schema document?

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]
Mar 6 '06 #4
I am using XMLSpy2006 Home edition. I think it is probably a bug in the
software to be honest, I have been informed of a coupld of other bugs
in the system. Unfortunately I can't show you the schema I was using as
it doesn't exist in that form anymore! It was identical to the schema
at http://www.dur.ac.uk/s.j.marjoribank...nterpreted.xsd
except that the last complex type, instead of referencing <gml:pos>
directly declared an element of type gml:LineStringType and then
restricted the allowed elements within it to only the <gml:pos>
element. The gml:pos and gml:LineStringType are in the
geometrybasic0d1d as imported at the top of the schema.

However, it's not really an issue now as I am not using that method
anymore, but thanks for enquiring!

Steve

Mar 6 '06 #5

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

Similar topics

3
by: Victor | last post by:
Hi, I have some sample XML and an XSD below I have written. The XSD almost does what I want. What I need is some way of enforcing that AT LEAST TWO of the attributes "TestAttribute" are "X". ...
1
by: Ranjit | last post by:
Hi, This may be quite a dumb question but I have not been able to address this convincibly. How can I specify restrictions on basic data types in my xml? I did some search and came across...
1
by: Brett Gerhardi | last post by:
Can anyone explain how I can do the following correctly: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"...
0
by: Douha | last post by:
Hi all, I have an XML file where all to elements for the data are contained in CDATA sections. I have a schema created that is working right now although it is pretty dumbed down. I have a need...
0
by: Eric van Wijk | last post by:
Hi, When I try to assign a schema to a dataset using the ReadXmlSchema method, that schema does not import any schemas included with xs:import. Both schema's are stored in the assembly as...
0
by: andrea | last post by:
According to the possibility of use custom section that must follow a precise schema, I've implemented my own one. The problem is with the compiler, that when start to debug my application hang up...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
2
by: WittyGuy | last post by:
Hi My class looks something like this: class Base { public: Base () {} ~Base () {} // No virtual dtor in the base class private: };
5
by: =?Utf-8?B?RG9u?= | last post by:
Hi I am trying to put value restrictions on certain elements in an xml file using a schema file. The syntax in my schema file looks like the following <xs:element name="AXYZMachines"...
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
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...
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: 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: 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: 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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.