473,473 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XML Schema never-never occurence of declared elements / attributes

Hi,

1) If I have a definition + declaration like
<complexType name="fattype">
<complexContent>
<element name="bar" minOccurs="0" maxOccurs="342"/>
</complexContent>
<attribute name="shanyang"/>
</complexType>

<element name="foo" type="fattype"></element>

and I want to make a derived-by-restriction subtype where the bar
element never appears, is there ANY other way to go than:

<element name="thinfoo">
<complexType><complexContent>
<restriction base="fattype">
<element name="bar" maxOccurs="0"/>
</complexContent>
<attribute name="shanyang" use="prohibited"/>
</complexType>
</element>

OK - my question really is: Looking at the declaration of thinfoo, I
have to make a set of element names that may occur as child elements of
thinfoo in any valid instance document. They don't HAVE to appear, there
just must a the possibility that they do. Now there is an element in the
content model of thinfoo that is declared, but never appears in an
instance, and thus should not be included in my set.

Can any of you guys / girls tell my whether this approach is safe:

Case: E is derived by restriction, or implicitly by extension from anyType:
- I traverse the whole content model of the E declaration recursively.
If I encounter an element with a minOccurs="0" (actual value) attribute,
then I ignore the element and its subelements. Otherwise, if the element
is an element declaration and it has a name, I add the name to my set,
but don't recurse. If it is an element declaration with a ref attribute,
I add it to my set, too.

Case: E is derived by extension (explicitly):
- I traverse the declaration like above. Then, I run the same algorithm
on the type that the base attribute refers to, and add the result of
that to my set.

-- will this get me the right set? Or are there other ways a declared
element may actually never appear in an instance?

And: Are there, likewise, any other way a declared attribute may never
appear, than a use="prohibited" attribute on its declaration?

Can anyone see any reason that I should bother to look at the base
declaration in the case of a derivation by restriction?

Hope there's a Schema expert out there who can help me -- and that some
sort of Medal of Honar may be awarded to those who have read the entire
spec with no nervous breakdowns.

Soren
Nov 28 '05 #1
1 1175
Soren Kuula writes:

Given this (corrected) type definition

<complexType name="fattype">
<sequence>
<element name="bar" minOccurs="0" maxOccurs="342"/>
</sequence>
<attribute name="shanyang"/>
</complexType>

The non-misleading restriction you want is

<element name="thinfoo">
<complexType>
<complexContent>
<restriction base="fattype">
<attribute name="shanyang" use="prohibited"/>
</restriction>
</complexContent>
</complexType>
</element>

This is of course an element useful only as an illustration, as it
must always be empty, with no attributes.

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]
Dec 1 '05 #2

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

Similar topics

2
by: Siddhartha Singh | last post by:
Hi, If XML can be validated by either DTD or Schema and Schema itself is a XML. How can we validate a Schema ? Cheers, Siddhartha Singh singh_siddhu@yahoo.com
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?...
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...
4
by: stiank81 | last post by:
Hi. I have a problem witch I assume there is an answear to....? I have several XML schemas, and they all have quiet a lot of definitions in common. They still have to be seperated into...
1
by: eXavier | last post by:
Hi, I need to validate XML fragment against XSD schema. The main issue is that xml fragment does not contain refrence to schema, but I want to force the validation against the schema I have in...
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...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
16
by: Bob Stearns | last post by:
The syntax diagram of DROP SCHEMA requires RESTRICT. Is there an easy way to drop an old, unnecessary, but populated schema?
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...
1
by: mflll | last post by:
How does one say in one schema that one wants an element defined in another schema. For example, I want to include in the Employee definition, an Address element defined in the schema...
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,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.