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

Home Posts Topics Members FAQ

Derivation by restriction and overriding the use property of an attribute

Hi

Right now I'm dealing with derivation by restriction and I have some
questions concerning the attribute property use in context of the
derivation.

Consider following Schema:

<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:complexType name="baseT">
<xs:attribute name="att" use="prohibited"/>
</xs:complexType>

<xs:complexType name="restrictedT">
<xs:complexContent>
<xs:restriction base="baseT">
<xs:attribute name="att" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>

<xs:element name="b" type="baseT"/>
<xs:element name="restr" type="restrictedT"/>

and the valid instance document:

<b att="strange" xsi:type="restrictedT"/>

The strange thing about this schema is the overriding of the Attribute "att"
and setting the attribute use="require". For the intance Document and its
Element "b" this definition means that by using type substitution (with
xsi:type) the attribute required and not prohibited as defined in the base
type. You can see this rather as a type extension instead of a restriction.

The "XML-Schema Part 1: Structures" permits this behaviour. (as I understood
it) The only combination that is not valid is changing a required attribute
to prohibited or optional.

As a validator I used xsv.

my question:

Whats the reason for this sample to be valid?

Perhaps I misunderstood the sense of use="prohibited"?

thx

Helmut

Jul 20 '05 #1
1 1710
Hi,

That example is not valid. Section 3.2.2 of XML Schema Part 1 says that
if use="prohibited", the "attribute" element corresponds to nothing at
all. This means that "att" is not an attribute of baseT (it is not
among its "attribute uses"), and therefore cannot be restricted in
restrictedT.

I don't think XSV implements all the constraints on restrictions.
Hope that helps,
Priscilla

-----------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema (Prentice Hall PTR)
http://www.datypic.com
-----------------------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #2

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

Similar topics

1
by: Benjamin Michotte | last post by:
Hello, I know this have no sense but it's a constraint from some obscure people working with me :/ I have a complex element which looks like <element name="foo"> <complexType> ... some data
3
by: Cat | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm having trouble getting my head around the reason the that following file won't validate with the following error output in Xerces version...
4
by: Lars Geldner | last post by:
Hello, I'm searching for a possibility to define a complex type using xml schema that can only be derived by restriction. The sub-complex type should have a content model that only contains...
3
by: hre1 | last post by:
stan, once more, thank you for your assistance and patience. can you explain in more detail why my code violates the particle restriction ok (Elt:Elt -- NameAndTypeOK)? i tried to understand...
3
by: Brett Gerhardi | last post by:
Hi all, can anyone explain why the following isn't valid? <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"...
3
by: Wells Caughey | last post by:
I am trying to create an XML Schema type definition by deriving from another type definition using restriction. For example suppose my base type was this: <xs:schema <<schema element setup>> >...
1
by: mahanatti_net | last post by:
Greetings. Below is the schema snippet I am trying to explore attributegroups and attribute's use property. However I am getting a validation error saying "undefined value for base encountered",...
2
by: ESPNSTI | last post by:
Hi, I'm very new to C# and .Net, I've been working with it for about a month. My experience has been mainly with Delphi 5 (not .Net). What I'm looking for is for a shortcut way to override a...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
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...
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
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
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.