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

Discussion in 'XML' started by Stefan Prange, Mar 16, 2005.

  1. 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
     
    Stefan Prange, Mar 16, 2005
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bdb112
    Replies:
    45
    Views:
    1,969
    jazbees
    Apr 29, 2009
  2. Stan Yamane

    Problems using services which return data using xsi:nil

    Stan Yamane, Jul 14, 2003, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    309
    Stan Yamane
    Jul 15, 2003
  3. xsi nil=true

    , Apr 25, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    380
  4. Jaime Stuardo

    xsi:nil="true" in parameter definition?

    Jaime Stuardo, Oct 6, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    395
    Jaime Stuardo
    Oct 6, 2005
  5. emil

    soap xsi:nil="true" problem for multi level objects

    emil, Oct 31, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    460
  6. Brian Candler

    puts nil generates "nil\n"

    Brian Candler, Nov 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    211
  7. Christoffer Sawicki
    Replies:
    5
    Views:
    522
    Christoffer Sawicki
    Sep 2, 2006
  8. Arie Kusuma Atmaja
    Replies:
    6
    Views:
    317
    Arie Kusuma Atmaja
    Apr 11, 2008
Loading...