AnsweredAssumed Answered

I am formatting an XML file that requires nil="true" to be passed as an attribute rather than a tag value if the input field is zero or spaces. I can't see how to do that.

Question asked by TresaLatham5741 on Sep 11, 2015
Latest reply on Oct 29, 2015 by Lee Sobotkin

I have an input file that has some fields that will come in as zero or spaces, and the requirement is that they be passed in the XML as  <sample_element xsi:nil=”true”/>.   <sample_element /> is not acceptable, nor is <sample_element>0</sample_element>.

The fields are defined in the schema as
<s:element name="sample_element" type="s:integer" nillable="true"/>
I imported the schema, and when I pass 0, it creates a tag that looks like this: <sample_element>0</sample_element>
When I pass spaces, it creates a tag that looks like this: <sample_element />

Does anyone know how I can get the correct format (<sample_element nil="true" />)?  The closest I can come is with custom coding and I get this: <sample_element>nil="true"</sample_element>, which isn't right either.