XSD Definition for Enumerated Value -


I am trying to define an XSD which has a field that can only be one of the following three values Basically, I want to define a strict calculation at the schema level:

  • Red
  • Blue
  • Basically, I want to define a strict calculation at the schema level.

    My first attempt is wrong and I am not sure about the "right" way to fix it.

      & lt; Xs: element name = "color" & gt; & Lt; XS: complexType & gt; & Lt; XS: Options & gt; & Lt; Xs: element name = "green" /> & lt; Xs: element name = "red" /> & Lt; Xs: element name = "blue" /> & Lt; / XS: Options & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt;  

    By using an automated XML generator, it treats those element names as string objects:

      & lt; Xs0: color & gt; & Lt; Xs0: green> Text & lt; / Xs0: green> & Lt; / Xs0: Color & gt; You can define an enumeration within a simple type of reference.  

    & lt; X: Simple Type Name = "Color" Last = "Ban" & gt; & Lt; Xs: restriction base = "xs: string" & gt; & Lt; Xs: calculation value = "green" /> & lt; Xs: calculation value = "red" /> & Lt; Xs: calculation value = "blue" /> & Lt; / XS: Ban & gt; & Lt; / XS: simpleType & gt; & Lt; Xs: element name = "some element" & gt; & Lt; XS: complexType & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "color" type = "color" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt;

    Comments

    Popular posts from this blog

    c# - ListView onScroll event -

    PHP - get image from byte array -

    Linux Terminal Problem with Non-Canonical Terminal I/O app -