Re: XML schema help for an XML document

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.

Noah

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

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








"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, 
Manikandan 

Received on Monday, 28 April 2008 18:32:39 UTC