BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

 
Lead By Knowing (Opens a new window)  

General Notice: No events within the next 45 days.

Generate XML with xsi:nil="true" when null value


 
Search this topic... | Search DI: Realtime and NRDM... | Search Box
Register or Login to Post    Forum Index -> Data Integrator -> DI: Realtime and NRDM  Previous TopicPrint TopicNext Topic
Author Message
hellmanj
Senior Member
Senior Member



Joined: 14 Sep 2007

Posts: 42



PostPosted: Wed Jan 26, 2011 2:31 pm 
Post subject: Generate XML with xsi:nil="true" when null value

I am creating my first XML file based on a provided XSD spec. The specification is widely used by other organizations, so I'm confident it is correct.

In examples they provide, a null field value should be reprensented by: <DiplomaCount xsi:nil="true" />

My file is generating the following instead:
ns1:DiplomaCount />

I have confirmed at the database the field value for DiplomaCount is null, and that I do not map a blank string or anything else to it. Am I missing an option that I need to set that will send xsi:nil="true"?

The XML validation tool provided by the vendor confirms that they will reject the file if the null fields do not contain xsi:nil="true" for null values in nullable elements.

We are running DI 11.7.3.1
I would appreciate feed back on this version, but would also like to know if things are different in future versions. So anything you know is appreciated.
Thanks
Back to top
hellmanj
Senior Member
Senior Member



Joined: 14 Sep 2007

Posts: 42



PostPosted: Wed Jan 26, 2011 2:55 pm 
Post subject: Re: Generate XML with xsi:nil="true" when null val

I'll keep updating as I figure out more.

Using the "Replace Null or Blank With" option for the fileformat in the dataflow does not generate the results I need. This produces:
<ns1:DiplomaCount>xsi:nil="true"</ns1:DiplomaCount>

My XML ref book from years ago states:

xsi:nil
"The xsi_:nil attribute indicates that a certain element does not have a value or that the value is unknown."...."It is not relevant whether an empty-element tag or start-tag/end-tag pair is used to represent the nil element."..."In order for this document to be valid, the element declaration for the name element must explicitly specify that nil values are allowed by setting the nillable attribute to true. For example:
<xs:element name="last_name" type="xs:string" nillable="true"/>"
Back to top
hellmanj
Senior Member
Senior Member



Joined: 14 Sep 2007

Posts: 42



PostPosted: Wed Jan 26, 2011 5:31 pm 
Post subject: Re: Generate XML with xsi:nil="true" when null val

I'm going to file a ticket as well with BOE. Using the "replace Nulls/Blank" option was promising enough that I tried it and then did a find/replace on the final file to shift the data inside the < /> brackets.

This does not work because not all fields that have a null/blank are allowed to use the special syntax of xsi:nil="true". For it to be valid, your FSD has to declare it using the following syntax.
<xsd:element name="DiplomaCount" nillable="true">

I looked at the attributes stored with the XML file format and it does not appear the DI version I am on is loading the Nillable value into an attribute. If it was, that would open up additional possibilities.
Back to top
Werner Daehn
Forum Devotee
Forum Devotee



Joined: 17 Dec 2004

speaker.gif*6
Posts: 10590
Location: Germany


flag
PostPosted: Thu Jan 27, 2011 6:57 am 
Post subject: Re: Generate XML with xsi:nil="true" when null val

Interesting. thumbsup.gif
_________________
Werner Daehn
Product Manager Data Services
SAP AG
“The opinions expressed in this post are my own views and not those of SAP.”

PLEASE SUPPORT THIS: Run one ATL job and tell us the benchmark result. Details to be found here.
Back to top
hellmanj
Senior Member
Senior Member



Joined: 14 Sep 2007

Posts: 42



PostPosted: Wed Apr 20, 2011 8:50 am 
Post subject: Re: Generate XML with xsi:nil="true" when null val

Filing a ticket resulted in the statement that this would need to be an enhancement request. These xsi:nil="true" option is not available in our version 11.7 nor did it sound to be available in any of the more recent versions of DI.

I solved this problem by using perl script and lookup file. The file has pairs of words seperated by a comma. One pair per line.
(e.g. <elementA></elementA>,<elementA xsi:nil=true><\elementA>)
The script goes through the list of 120 pairs and does a global find replace writing the results to a new file.

My Perl is a bit rusty, but my sys admin mentioned he had something and saved me some time. Not sure if I can share the code.
Back to top
cpmohanraj
Forum Associate
Forum Associate



Joined: 23 Sep 2002

Posts: 708
Location: Perth, Australia


flag
PostPosted: Mon Mar 19, 2012 8:26 am 
Post subject: Re: Generate XML with xsi:nil="true" when null val

What if I consume a web service which uses the NILABLE elements in the request. How do I pass them xsi:nil=true instead of the element which is nested?

And will I be able to see the SOAP request envelope that gets generated?

_________________
Mohanraj CP
Perth, Australia
http://blog.mohanraj.org
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> Data Integrator -> DI: Realtime and NRDM  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0452 seconds using 17 queries. (SQL 0.0027 Parse 0.0342 Other 0.0083)
CCBot/2.0 (http://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo