I want to validate whether a particular element is in given set or not.
This set is defined dynamically.
Please see the following sample.  Parser does complain if an ID does not
appears in the given set but
it does not allow me to define more than one such ID for the element in
key ref. Is this a valid functionality
of key/key ref? If yes, is there any other way to achieve the required
functionality? I am using Oracle parser.
Any help would be greatly appreciated.

Regards,
Kiran

In short: Why can not I define  Value.ID = 1 twice?

-----------------------------------------------------------------
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema";
        targetNamespace="my.trial"
        xmlns:my="my.trial"
        elementFormDefault="qualified">

<xsd:element name="trial">
 <xsd:complexType>
  <xsd:sequence>
    <xsd:element name="ValidSet" type="my:ValidSetType"
maxOccurs="unbounded"/>
    <xsd:element name="Values" type="my:ValuesType"
maxOccurs="unbounded"/>
  </xsd:sequence>
 </xsd:complexType>

  <key name="valid_values">
      <selector xpath="my:ValidSet"/>
      <field xpath="my:ValidID"/>
  </key>

  <keyref name="value" refer="valid_values">
      <selector xpath="my:Values"/>
      <field xpath="my:ID"/>
  </keyref>

</xsd:element>

<xsd:complexType name="ValidSetType">
    <xsd:sequence>
        <xsd:element name="ValidID" type="xsd:positiveInteger"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ValuesType">
    <xsd:sequence>
 <xsd:element name="ID" type="xsd:positiveInteger"/>
   </xsd:sequence>
</xsd:complexType>

</xsd:schema>

--------------------------------------------------------------------
<?xml version="1.0"?>
<trial xmlns = "my.trial"
     xmlns:my="my.trial"
     xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";
     xsi:schemaLocation =
  "my.trial
   keykref.xsd">

  <ValidSet>
      <ValidID>1</ValidID>
  </ValidSet>

  <ValidSet>
      <ValidID>2</ValidID>
  </ValidSet>

  <Values>
      <ID>1</ID>
  </Values>

  <Values>
      <ID>1</ID>
  </Values>

</trial>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to