Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to send blank for integer / long in XML ?

Posted on 2014-04-14
7
Medium Priority
?
456 Views
Last Modified: 2014-04-14
Hi
Below is my element in XSD. In 'ParentSDSID' I want to send blank. Just <ParentSDSID></ParentSDSID> and it can be long.
how to form the xsd? I tried nillable="true", but is it not accepting.

Can anyone suggest me please?

<xs:element type="xs:long" nillable="true" name="ParentSDSID"/>
0
Comment
Question by:GouthamAnand
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 39999480
I don't think nillable is the answer
because then you need to explicitely set the xsi:nil attribute to make it work
is that acceptable?
<ParentSDSID xsi:nil="true"></ParentSDSID>
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 39999499
Here is what I would do

    <xs:element type="long-and-null" name="ParentSDSID"/> 
    <xs:simpleType name="long-and-null">
        <xs:union memberTypes="stp-long stp-empty"/>
    </xs:simpleType>
    <xs:simpleType name="stp-long">
        <xs:restriction base="xs:long"/>
    </xs:simpleType>
    <xs:simpleType name="stp-empty">
        <xs:restriction base="xs:string">
            <xs:maxLength value="0"/>
        </xs:restriction>
    </xs:simpleType>

Open in new window

0
 

Author Comment

by:GouthamAnand
ID: 39999558
Hi
Attached is my schema. Could you please update it ?
I am confused with your xsd structure.
XYZRequestSchema.xsd
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 39999600
I understand you are confused because the element declaration that you have is a local declaration

The snippet I sent has three simple type declarations, they should be at the global level
(in a way you could say I am extending the type library)

then you could use the type in the element declaration

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="XYZDocStatusRequest">
        <xs:annotation>
            <xs:documentation>XYZ Message</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Header">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element type="xs:long" name="MsgId"/>
                            <xs:element type="xs:string" name="Source"/>
                            <xs:element type="xs:dateTime" name="SendTime"/>
                            <xs:element type="xs:string" name="Action"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="Body">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element type="xs:long" name="AOSID"/>
                            <xs:element type="long-and-null" name="ParentSDSID" minOccurs="0"/>
                            <xs:element name="AOSRegion">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element type="xs:short" name="Id"/>
                                        <xs:element type="xs:string" name="Name"/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="ProductType">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element type="xs:long" name="Id"/>
                                        <xs:element type="xs:string" name="Name"/>
                                        <xs:element type="xs:string" name="FullPath"/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="BookingCentreSDSId">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element type="xs:short" name="Id" maxOccurs="unbounded" minOccurs="0"/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="Status">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element type="xs:short" name="Id"/>
                                        <xs:element type="xs:string" name="Name"/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element type="xs:string" name="TaxDocumentationRequired"/>
                            <xs:element type="xs:string" name="UpdateReason"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    
    <xs:simpleType name="long-and-null">
        <xs:union memberTypes="stp-long stp-empty"/>
    </xs:simpleType>
    <xs:simpleType name="stp-long">
        <xs:restriction base="xs:long"/>
    </xs:simpleType>
    <xs:simpleType name="stp-empty">
        <xs:restriction base="xs:string">
            <xs:maxLength value="0"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>

Open in new window

0
 

Author Closing Comment

by:GouthamAnand
ID: 39999620
Thanks a lot.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 39999727
welcome
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question