Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML Schema Q: Preventing an empty element of a complex type

Reply
Thread Tools

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

 
 
Rich Weed
Guest
Posts: n/a
 
      07-16-2003

<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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wsdl2java: method parameter a complex type that extends another complex type Robert Mark Bram Java 0 02-04-2007 10:06 AM
XML-Schema: Is there a way to make different type elements(each type has more than one Element) present in random order? Aray XML 1 01-05-2007 08:22 AM
Altova Mapforce - xml 2 xml map: empty elements output although input element is not empty Lukas XML 3 11-10-2005 02:25 PM
[XML Schema] Content type of complex type definition with complex content Stanimir Stamenkov XML 2 10-25-2005 10:16 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM



Advertisments