?
Solved

How to send blank for integer / long in XML ?

Posted on 2014-04-14
7
Medium Priority
?
448 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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