XML Schema Q: Preventing an empty element of a complex type

Discussion in 'XML' started by Rich Weed, Jul 16, 2003.

  1. Rich Weed

    Rich Weed Guest

    <root>
    <contact>
    <name1>Joe Blough</name1>
    <name2>c/o Blough, Inc</name2>
    <addr1>123 Happy St</addr1>
    <addr2>PO Box 1234</addr2>
    <city>Anywhere</city>
    <state>GA</state>
    <zip>12345</zip>
    </contact>
    </root>

    I have an XML Schema for the above structure. All the child elements of
    <contact> are optional (minOccurs=0), of type string, and not allowed to be
    empty (minLength=1) (whitespace is allowed...so a single space is valid).

    Since the child elements are all optional, the schema does currently allow
    an empty <contact> element as '<contact />' or '<contact></contact>'.

    Q: How do I prevent the appearance of <contact /> from being valid? In
    other words how do I force at least one child element to be present when
    <contact> is present?

    TIA, RW

    --

    Remove NO SPAM to reply
     
    Rich Weed, Jul 16, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,580
    Markus
    Nov 23, 2005
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,275
    Stanimir Stamenkov
    Apr 25, 2005
  3. Stanimir Stamenkov
    Replies:
    2
    Views:
    755
    Stanimir Stamenkov
    Oct 25, 2005
  4. Lukas
    Replies:
    3
    Views:
    820
    spiff
    Nov 10, 2005
  5. Robert Mark Bram
    Replies:
    0
    Views:
    694
    Robert Mark Bram
    Feb 4, 2007
Loading...

Share This Page