dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Help with "nillable"

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Help with "nillable"

    I am fairly new to XML and am having trouble with a new element requirement. We are using a fairly complex XSD (at least complex to me) and a recent update includes the attribute nillable = "true" for some numeric values.

    I cannot get the feed to validate (using XML Notepad) when any of these numeric values are null and need help understanding why.

    I'm not sure what needs to be posted here for help, so will just post a few bits here:

    From the XSD file in the heading:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

    From the XSD file for the elements in question:
    <xs:element name="ProductPrice">
    <xs:complexType>
    <xs:sequence>
    </xs:element>
    <xs:element name="PriceA" type="xs:float" nillable="true">
    </xs:element>
    <xs:element name="PriceB" type="xs:float" nillable="false">
    </xs:element>
    <xs:element name="PriceC" type="xs:float" nillable="true">
    </xs:element>
    <xs:element name="PriceD" type="xs:float" nillable="true">
    </xs:element>
    <xs:element name="PriceE" type="xs:float" nillable="true">
    </xs:element>
    <xs:element name="PriceF" type="xs:float" nillable="true">
    </xs:element>
    <xs:element name="PriceG" type="xs:float" nillable="true">
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>

    From the XML file:
    <?xml version = "1.0" encoding="ISO-8859-1"?><ProductImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <ProductPrice>
    <PriceA>99.99</Price>
    <PriceB>99.99</ListPrice>
    <PriceC>99.99</BasPrice>
    <PriceD>0.00</AfterRebatePrice>
    <PriceE xsi:nil="true"/>
    <PriceF xsi:nil="true"/>
    <PriceG xsi:nil="true"/>
    </ProductPrice>

    The error that I am getting is that the value of the elements PriceE, PriceF and PriceG is not valid because of the "float" definition. I cannot include a value for these prices - zero is not correct.

    How do I format the XML for the "ProductPrice" so that it is valid.

  2. #2
    Join Date
    Apr 2012
    Posts
    2
    My apologies - there were some significant errors in my previous post. Here is the correct XML:

    From the XML file:
    <?xml version = "1.0" encoding="ISO-8859-1"?><ProductImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <ProductPrice>
    <PriceA>99.99</PriceA>
    <PriceB>99.99</PriceB>
    <PriceC>99.99</PriceC>
    <PriceD>0.00</PriceD>
    <PriceE xsi:nil="true"/>
    <PriceF xsi:nil="true"/>
    <PriceG xsi:nil="true"/>
    </ProductPrice>

    Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles