Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSD mandatory element

Reply
Thread Tools

XSD mandatory element

 
 
Chris West
Guest
Posts: n/a
 
      06-27-2003
I have an schema that defines an element as mandatory, but I also want the
XML instance to have some content for that mandatory element.

I can use a regular expression to guarantee content, but I'm interested to
know if there is another way to achieve this (an attribute setting perhaps)?

Thanks

Chris



 
Reply With Quote
 
 
 
 
Colin Mackenzie
Guest
Posts: n/a
 
      06-27-2003
are you saying that the instance has to have some mandatory text content?

if so look at a minLength restriction on the element type in the schema e.g.

<xsd:simpleType name="PopulatedStringType">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>

but remember that an element using this type would allow <mandatory>
</mandatory>
you could further restrict the string with a pattern to say that the content
must not be all white space

Colin

"Chris West" <> wrote in message
news:bdgvf7$g6h$...
> I have an schema that defines an element as mandatory, but I also want the
> XML instance to have some content for that mandatory element.
>
> I can use a regular expression to guarantee content, but I'm interested to
> know if there is another way to achieve this (an attribute setting

perhaps)?
>
> Thanks
>
> Chris
>
>
>



 
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
XSD restriction of nesting an element within another element with aspecific attribute value? PeteOlcott XML 1 02-05-2009 06:39 AM
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
XSD: complexType with mandatory and optional elements in arbitraryorder? Thomas Wittek XML 4 09-13-2007 12:04 PM
XML + XSD: Is it possible to get all errors against the XSD? Markus Java 1 11-22-2005 02:53 PM
XSD - element, element value and attribute ? Matthet XML 2 09-24-2003 04:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57