473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

XSD mandatory element

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

Jul 20 '05 #1
1 4688
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" <ch****@memex.com> wrote in message
news:bd**********@mxgate.memex.co.uk...
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

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Frans Englich | last post by:
Hello, In my use of getopt.getopt, I would like to make a certain parameter mandatory. I know how to specify such that a parameter must have a value if it's specified, but I also want to make...
0
by: mark.van.der.voort | last post by:
Hi, I have defined a simple key/keyref validation for describing a tree. <xs:key name="key_member"> <xs:selector xpath=".//member"/> <xs:field xpath="@id"/> </xs:key> <xs:keyref...
0
by: Softwaremaker | last post by:
I tried the tool...However, I think it was fairly difficult to use. Unless my config is wrong somewhat, everthing is a Passed. Any other tool you can recommend ? If not, do u know if the Service...
0
by: Ollie | last post by:
I have defined a set of SOAP messages using an xsd file, each element in the xsd has the minoccurs, maxoccurs & nillable attributes defined when I then use xsd.exe to generation C# classes for...
1
by: Le Tubs | last post by:
Hi I am wondering if anybody has come accross this problem before, basically I have to validate a xml schema (not the data, this is done at a later stage). The only problem is that there are...
1
by: Fan | last post by:
Hi, everyone When I first set up a web service in .Net 1.1, seems .Net will automatically build the WSDL file. And the element type of each field in input and output has been automatically...
6
by: Ruso | last post by:
I have this function, which should change a value of the texfield(s) depending on the radio buttons selection. function foo(obj) { if (!array) { flag++; } if (array != obj.value ) {...
3
by: ANoobee | last post by:
What is the best approach to force atleast one of a few optional elements required in an XSD? This is what I'm tring to do: <email> <to> <cc> <bcc> </email>
15
by: =?Utf-8?B?TWFkcyBOaWVsc2Vu?= | last post by:
Hi, I am developing a web service for a customer. The service has a method, that returns an array of Forms. Each form has a Name property of Type String. The customer wants the contract to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.