Using IDREF and enumeration within Union

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stran
    New Member
    • May 2007
    • 2

    #1

    Using IDREF and enumeration within Union

    I'm trying to create a simple type that holds two different types. The first is IDREF and the second is an enumeration of string. When I generate a sample xml, I can enter any ID previously stated in the xml and validates correctly. When I try to use one of the enumeration in the drop down list, the xml will not validate.
    When I validate the xml in xmlspy, i get the error message "IDREF 'endofprogam': referenced ID 'endofprogam' was not found."
    Anyone knows a solution to having a union of enumeration and IDREF? I would appreciate any help.

    <xs:simpleTyp e name="Persist_E num_Type">
    <xs:annotatio n>
    <xs:documentati on>Persist gives the UTR multiple options of lifetime</xs:documentatio n>
    </xs:annotation>
    <xs:union memberTypes="xs :IDREF">
    <xs:simpleTyp e>
    <xs:restricti on base="xs:string ">
    <xs:annotatio n>
    <xs:documentati on>
    End of Program (EOP)
    End of Children (EOC)
    End of Lifetime (EOL)
    Persist to Label (PTL)
    </xs:documentatio n>
    </xs:annotation>
    <xs:enumerati on value="endofpro gram"/>
    <xs:enumerati on value="endofchi ldren"/>
    <xs:enumerati on value="endoflif etime"/>
    <xs:enumerati on value="persistt olabel"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:union>
    </xs:simpleType>
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by stran
    I'm trying to create a simple type that holds two different types. The first is IDREF and the second is an enumeration of string. When I generate a sample xml, I can enter any ID previously stated in the xml and validates correctly. When I try to use one of the enumeration in the drop down list, the xml will not validate.
    When I validate the xml in xmlspy, i get the error message "IDREF 'endofprogam': referenced ID 'endofprogam' was not found."
    Anyone knows a solution to having a union of enumeration and IDREF? I would appreciate any help.

    Code:
    <xs:simpleType name="Persist_Enum_Type">
    <xs:annotation>
    <xs:documentation>Persist gives the UTR multiple options of lifetime</xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xs:IDREF">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:annotation>
    <xs:documentation>
    End of Program (EOP)
    End of Children (EOC)
    End of Lifetime (EOL)
    Persist to Label (PTL)
    </xs:documentation>
    </xs:annotation>
    <xs:enumeration value="endofprogram"/>
    <xs:enumeration value="endofchildren"/>
    <xs:enumeration value="endoflifetime"/>
    <xs:enumeration value="persisttolabel"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:union>
    </xs:simpleType>
    Hopefully you're still looking for this...

    I sounds like MSXML.NET validates XML a bit better than XMLSpy. I am not sure how accurate this is, but I say give it a whirl. It was suggested that a good way to write it would be:

    Code:
    <union>
    <simpleType of enumeration>
    <simpleType of IDREF>
    </union>
    Hope this helps!
    Last edited by Dököll; Jul 4 '07, 05:59 PM. Reason: Text

    Comment

    Working...