|
-
Dec 13th, 2004, 09:06 PM
#1
Thread Starter
Frenzied Member
XML/XSD: xs:date and nillable
If I allow a nillable date element like this
Code:
<xs:element name="DOB" type="xs:date" nillable="true"/>
how can I write my element so it validates when there is no date - e.g. You don't know the DOB (date of birth)
Using XmlSpy to test, will need to validate with .NET.
I've tried an empty element, "0000-00-00", and just not including the element, nothing works so far.
-
Dec 14th, 2004, 05:23 AM
#2
Re: XML/XSD: xs:date and nillable
From the standard:
If {nillable} is true, then an element may also be ·valid· if it carries the namespace qualified attribute with [local name] nil from namespace http://www.w3.org/2001/XMLSchema-instance and value true (see xsi:nil (§2.6.2)) even if it has no text or element content despite a {content type} which would otherwise require content. Formal details of element ·validation· are described in Element Locally Valid (Element) (§3.3.4).
Therefore, given that xsi is the namespace prefix of XMLSchema-instance, the element would look like
<DOB xsi:nil="true"/>
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 14th, 2004, 10:01 AM
#3
Thread Starter
Frenzied Member
Re: XML/XSD: xs:date and nillable
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|