Hey All -
I'm stuck while trying to write a schema, hoping someone can provide me
with a flash of inspiration.
One of the elements I'm writing has two attributes, both of which are
optional. I want to express in the schema that there's a relationship
between the two -- that the second attribute is optional only if the
first one is not specified. ie:
<myElement /> <!-- valid -->
<myElement name="A" /> <!-- valid -->
<myElement myattr="true" /> <!-- invalid because name wasn't specified
-->
<myElement myattr="true" name="A" /> <!-- valid -->
So far my schema looks like this:
<element name="myElement ">
<complexType>
<attribute name="name" type="string" use="optional" />
<attribute name="myattr" type="boolean" use="optional"
default="false" />
</complexType>
</element>
That captures the default values and the optional nature of the two
elements, but it doesn't capture the relationship between the two. Is
there any xsd construct I can use to express the relationship? I know
how to do it with elements (xsd:group, xsd:choice) but not with
attributes.
Thanks for any thoughts.
Stewart 2 2755
Stewart Johnson wrote: I'm stuck while trying to write a schema, hoping someone can provide me with a flash of inspiration.
One of the elements I'm writing has two attributes, both of which are optional. I want to express in the schema that there's a relationship between the two -- that the second attribute is optional only if the first one is not specified. ie:
<myElement /> <!-- valid --> <myElement name="A" /> <!-- valid --> <myElement myattr="true" /> <!-- invalid because name wasn't specified --> <myElement myattr="true" name="A" /> <!-- valid -->
So far my schema looks like this:
<element name="myElement "> <complexType> <attribute name="name" type="string" use="optional" /> <attribute name="myattr" type="boolean" use="optional" default="false" /> </complexType> </element>
That captures the default values and the optional nature of the two elements, but it doesn't capture the relationship between the two. Is there any xsd construct I can use to express the relationship? I know how to do it with elements (xsd:group, xsd:choice) but not with attributes.
I don't think that a W3C XML schema can express such constraints between
attributes. Other schema languages are more powerful in that regard, for
instance schematron should allow that.
--
Martin Honnen http://JavaScript.FAQTs.com/
Martin Honnen <ma*******@yaho o.de> wrote in message news:<41******* *************** *@newsread2.arc or-online.net>... Stewart Johnson wrote:
I'm stuck while trying to write a schema, hoping someone can provide me with a flash of inspiration.
One of the elements I'm writing has two attributes, both of which are optional. I want to express in the schema that there's a relationship between the two -- that the second attribute is optional only if the first one is not specified. ie:
<myElement /> <!-- valid --> <myElement name="A" /> <!-- valid --> <myElement myattr="true" /> <!-- invalid because name wasn't specified --> <myElement myattr="true" name="A" /> <!-- valid -->
So far my schema looks like this:
<element name="myElement "> <complexType> <attribute name="name" type="string" use="optional" /> <attribute name="myattr" type="boolean" use="optional" default="false" /> </complexType> </element>
That captures the default values and the optional nature of the two elements, but it doesn't capture the relationship between the two. Is there any xsd construct I can use to express the relationship? I know how to do it with elements (xsd:group, xsd:choice) but not with attributes.
I don't think that a W3C XML schema can express such constraints between attributes. Other schema languages are more powerful in that regard, for instance schematron should allow that.
Hi,
I don't think you can do it using attributes. But you can express it
using elements : use a <xs:choice> within a <xs:sequence> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jeff Lanfield |
last post by:
Suppose I have users that can belong to organizations. Organizations
are arranged in a tree. Each organization has only one parent
organization but a user maybe a member of multiple organizations.
The problem that I'm facing that both organizations and individual
users may have relationships with other entities which are
semantically the same. For instance, an individual user can purchase
things and so can an organization. An individual...
|
by: Tom |
last post by:
Hi,
Do you guys know what's wrong with a one-to-one relationship?
The reason I want to make it like this is that at the very end of the chain,
the set of keys is huge. I want to limit the number of columns to be the
key. i.e. the table has 1 column as the key. The
table will have 2 columns as the key.
|
by: Melissa |
last post by:
I have a frontend file named CustomerApp and backend file named CustomerData.
CustomerApp is at C:\Customer Database and CustomerData is at S:\Customer
Database. Could someone help me with the code to do the following:
1. Create a new table named TblCustomerContact in CustomerData
2. Add a field named CustomerContactID (autonumber) in TblCustomerContact
3. Add a field named CustomerID (Number-Long) in TblCustomerContact
4. Add a field...
|
by: Mason |
last post by:
I have a table consisting of people and their attributes. I would
like to create a relationship matrix table that records the
relationships between the people. So the two tables would look
something like this:
tblPeople
*ID, AutoNumber
LastName, Text
FirstName, Text
|
by: MDS |
last post by:
All,
I would like to implement a recursive relationship in a table with
referential integrity enforced and cascade update turned on.
For example, a horse has a sire and dam. Both the sire and the dam
must be horses and, therefore, drawn from the same domain.
Is it possible to implement this recursive relationship in Access 97
having "Sire" and "Dam" attributes in the "Horse" table?
| |
by: BrianDP |
last post by:
This is a strange one--
I have an Access 2K database with a split front end/back end. There
are two tables in the back end - RFile and RLine. There is a one to
many relationship from Rfile.Rnumber to Rline.Rnumber. Originally I
went in with the Relationships window, drew the line, and clicked the
cascading updates and deletes. Everything was fine, for a couple of
years.
All of the sudden however, this relationship seems to delete...
|
by: JavaXMLDev |
last post by:
Hi
I'm new to XML schema work, but wondered how, if at all possible, can you specify a relationship between the values of an element's attributes.
Essentially I want context sensitive auto-complete for the attribute values of an element when creating an XML document.
I dont know how to define the relationship !
Scenario:
When using a location element and selecting the school
value for the type attribute I would like to restrict...
|
by: Yitzak |
last post by:
Hi after adding a field to a table through VBA
How do I create a foreign key constraint/relationship between this
field and a field in another table - and enforce referential integrity
through VBA code.
Thanks
|
by: King |
last post by:
This is a new test for object persistency. I am trying to store the
relationship between instances externally.
It's not working as expected. May be I am doing it in wrong way. Any
suggestions?
import shelve
class attrib(object):
pass
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |