how to create our own boolean type in XSD?

Hi,

One of my XML element <TaxDocumentationRequired> should have either 'Y' or 'N'.

I did as below - but still it did not work for me.
It says "Type 'http://www.w3.org/2001/XMLSchema:myBoolean' " is not declared.

<xs:element type="xs:myBoolean" name="TaxDocumentationRequired"/>

<xs:simpleType name="myBoolean">
      <xs:restriction base="xs:string">
            <xs:enumeration value="Y"/>
            <xs:enumeration value="N"/>
      </xs:restriction>
</xs:simpleType>

Can anyone help please?
GouthamAnandAsked:
Who is Participating?
 
Geert BormansInformation ArchitectCommented:
you can't declare types in the xs schema namespace,
it needs to be in the targetNamespace

<xs:element type="myBoolean" name="TaxDocumentationRequired"/>

should work
0
 
GouthamAnandAuthor Commented:
Thanks a lot.
0
 
Geert BormansInformation ArchitectCommented:
welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.