OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   schema key/keyRef question

[ Lists Home | Date Index | Thread Index ]

Hi,

I am using a node in my xml to define variables. The defined variables 
are referenced by ID in another node (a project). The problem is that 
some variables have sub-ids (the variables are "buckets" instead of 
numeric values, they can have values like "high" "med" "low")

So - the xml looks like...

<meta>
    <var name="var1" id="1">
          <buckets>
                <bucket name="High" bID="10"/>
                <bucket name="Med" bID="11"/>
          </buckets>
    </var>
    <var name="var2" id="2">
          <buckets>
                <bucket name="Some Value" bID="3"/>
                <bucket name="Another Value" bID="10"/>
          </buckets>
    </var>
</meta>
<projects>
    <project>
        <var id="1" bID="10"/>     <!-- bID="3" should throw an error-->
    </project>
</projects>

I want to make sure (using xsd) that each project's variables' bID 
matches one of the available bIDs where project/var id== meta/var id. 
E.g. in above sample, if project/var id==1, then project/var bID has to 
be either "10" or "11" - or an error is thrown.

I've thought of one (rather redundant) solution - by copying the id into 
the bucket node, I can have a key/keyRef comparison with composite 
fields. E.g., xsd would read....

        <xs:key name="multiIDs">
            <xs:selector xpath="./meta/var/buckets/bucket"/>
            <xs:field xpath="@bID"/>
            <xs:field xpath="@id"/>
        </xs:key>
        <xs:keyref name="multiIDsRef" refer="multiIDs">
            <xs:selector xpath="./projects/project/var"/>
            <xs:field xpath="@bID"/>
            <xs:field xpath="@id"/>
        </xs:keyref>

and the var node would change to

    <var name="var1" id="1">
          <buckets>
                <bucket name="High" bID="10" id="1"/>
                <bucket name="Med" bID="11" id="1"/>
          </buckets>
    </var>

Just hoping there's a better way than that. (Project var values can 
change over time - so there would be a lot more redundancy than shown)

Thanks for any help,

Doug
-- 





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS