• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

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?
0
GouthamAnand
Asked:
GouthamAnand
  • 2
1 Solution
 
Geert BormansCommented:
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 BormansCommented:
welcome
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now