Jump to content
Guest padukka

How to define an element which can be left blank?

Recommended Posts

Guest padukka

Hi! all,I'm new to XSD. I wanna know what is the syntax which enables an element can be left blank(value)?XML<example></example>Thanx in advance...Janaka

Share this post


Link to post
Share on other sites

Yes. By defining an xs:restriction (with whatever is the original base type) that uses the xs:minLength element with a value of 0. Read more about Schema's restrictions if you didn't understand what I just said.

Share this post


Link to post
Share on other sites

You can use <restriction> mark up to do the same.Here is the code...Assuming you know some basics of XML Schema.

<xs:element name="example">	  <xs:simpleType>			  <xs:restriction>					 <xs:maxLength value="0"/>			  </xs:restriction>	  </xs:simpleType></xs:element>

element tag: use to define element name.simpleType tag: use to define element with no child element and no attributes.restriction tag: use to put some constraint on value of element.maxLength tag: they are like Methods which can handle value of the element.nJoy your work...Always!!! :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...