How do I specify a nullable xs:int?

J

jacksuyu

I have one xsd which defines element "Port" as "xs:int", and there are
bunch of xml files use "Port" element. But a lot of those files
contains <Port/>, which is treated invalid in xml validation.

I am wondering whether there is anyway to specify nullable integer, say
treat <Port/> the same as <Port>0</Port>?

Thanks in advance.
 
H

Henry S. Thompson

jacksuyu said:
I am wondering whether there is anyway to specify nullable integer, say
treat <Port/> the same as <Port>0</Port>?

That's a defaulted xs:int, not a nullable one, and yes, just declare

<xs:element name="Port" type="xs:int" default="0"/>

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top