www.webdeveloper.com
Results 1 to 3 of 3

Thread: New to XML Schemas

  1. #1
    Join Date
    Jan 2009
    Posts
    1

    New to XML Schemas

    Im new to schemas and I have to update an existing one.

    Basically I have two xml elements to test that they are of string value (which is already completed), but I need a clause in here now to say if one of the fields is blank and the other not then allow it through the schema, if both fields are blank fail to go through the schema.

    Any help greatly received

  2. #2
    Join Date
    May 2008
    Posts
    381
    Well, there is the minLength restriction:
    Code:
    <xs:element name="example-field">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:minLength value="1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:element>

  3. #3
    Join Date
    May 2007
    Posts
    288
    Sounds like a co-occurrence constraint, not doable in XML Schema 1.0, but doable in 1.1 or Schematron, or RelaxNG.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles