Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. xsd restriction

xsd restriction

Scheduled Pinned Locked Moved XML / XSL
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    In my xsd file I have a bool element. I want to set a restriction so that it can only be set to true if a previous element is present and has a particular value. Something like this

    <xs:simpleType name="someEnum">
    <xs:restriction base="xs:string">
    <xs:enumeration value="Value1" />
    <xs:enumeration value="Value2" />
    </xs:restriction>
    </xs:simpleType>

    ...

    <xs:element name="Field1" type="someEnum" minOccurs="0" maxOccurs="1" />
    <xs:element name="Field2" type="xs:boolean" minOccurs="0" maxOccurs="1" />

    I want to change it so that Field2 can only be true if Field1 is Value2 from the enum

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups