Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
    Bookmark Topic Watch Topic
  • New Topic

xsd: how to define an element of type integer which can validate even if it is empty

 
Bipul Kumar Singh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

Can anyone help me solve this problem

I want to define an element to type integer
so we can do something like this ...

<xs:simpleType name="status">
<xs:annotation>
<xs ocumentation>0=CLOSED</xs ocumentation>
<xs ocumentation>1=OPEN</xs ocumentation>
</xs:annotation>
<xs:restriction base="xs:integer">
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
</xs:restriction>
</xs:simpleType>
But the problem is this will not validate an xml
<status></status>

Can anyone pl. tell me what I can use in XSD so that this gets validated
Note: I cant add any thing in xml as its getting generated automatically

Thanks in advance
Bipul
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question to several places.
I'm closing this thread. Please continue the discussion over there.

Thank you.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!