W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2008

Re: XML schema help for an XML document

From: <noah_mendelsohn@us.ibm.com>
Date: Mon, 28 Apr 2008 14:32:54 -0400
To: "Manikandan Thangavelu" <Manikandan_T1@verifone.com>
Cc: xmlschema-dev@w3.org
Message-ID: <OF2C1ACFD5.D12F1E24-ON85257439.006575C8-85257439.0065AAC1@lotus.com>

The short answer to your question is:  enforcing the constraint that 
occurrence of two attributes be mutually exclusive is not possible in XML 
Schema 1.0, which is the current widely deployed version.  Doing this will 
be straightforward using the planned <assertion> feature of XSD 1.1 [1]. 
Thank you.


[1] http://www.w3.org/TR/xmlschema11-1/#cAssertions

Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142

"Manikandan Thangavelu" <Manikandan_T1@verifone.com>
Sent by: xmlschema-dev-request@w3.org
04/27/2008 12:02 PM
        To:     <xmlschema-dev@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        XML schema help for an XML document

From:   Manikandan Thangavelu  
Sent:   27 April 2008 21:27 
To:     'xmlschema-dev-request@w3.org' 
Subject:        XML schema help for an XML document 
Hi All, 
I am trying to develop an XML schema for an XML file which is used to 
build the UI for an application. 
I have an issue in it.In one of my XML tags there are two attributes out 
of which one is mandatory and presence of both are mutually exclusive.If 
one of those attibbute is present, then the other should not.Follwing is 
the sample of my XML
    <Menuitem name="_Contents" ID= "ID_CONTENTS" Description="Help 
Contents." /> 
    <Menuitem name="_Index" ID= "ID_INDEX" Description="Help Index." /> 
    <Menuitem name="_Search" ID= "ID_SEARCH" Description="Help Search." /> 

    <Menuitem name="_About Me" ID= "ID_ABOUT_Me" Description="VeriCentre 
version information and Add-on(s) installed." />
    <Menuitem name="_Notepad" ApplicationPath="C:\Windows\notepad.exe" 
Description="Opens the notepad application."/> 
    <Menuitem name="Adobe" ApplicationPath="C:\Program 
Files\Adobe\Adobe.exe" Description="Open Adobe"/> 

Among the attributes for Menuitem either "ID" or "ApplicationPath" is 
mandatory.If "ID" is there, then "ApplicationPath" should not be and if 
"ApplicationPath" is there, then "ID" should not be.
How can I develop a schema for this case? 
Thanks in Advance, 
Received on Monday, 28 April 2008 18:32:39 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:46 UTC