By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,409 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,409 IT Pros & Developers. It's quick & easy.

Empty Elements: implicit xsi:nil="true" possible ?

P: n/a
Hi everyone,

I have a little problem here and wasn't able to find a proper solution
by searching the web. So this newsgroups is my last resort ;-)
I have an xml-schema definition of an element which reads:
<xsd:element name="DoubleValue" type="xsd:double" nillable="true"/>

In my instance document I have the following element:
<DoubleValue/>
This line is rejected during schema-validating the document with the
message "The value '' of element 'DoubleValue' is not valid."

When I provide the element explicitely with the "xsi:nil"-attribute it's
parsed as valid. This is the valid element:
<DoubleValue xsi:nil="true"/>

(To make this work I had to extend the root element of my schema
definition with the xsi:nil-attribute. It now looks like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:nil="true">
)
Now, my question is:
Is it possible to tell the XML engine to implicity assume the
xsi:nil="true" attribute when it comes across an empty element?
This would let me keep the simpler form of empty elements (<DoubleValue/>).

I'm using Xerces 2.6.2 as XML engine.

Any help is greatly appreciated.
Thanks in advance.

Stefan

Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.