By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,411 Members | 999 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,411 IT Pros & Developers. It's quick & easy.

ImportNodes adds xsi:nil="true" when maxoccurs > 1

P: n/a
I'm writing a program which uses the ImportNode function of an
XMLDataDocument. This works fine for elements which may appear once at
most; however, for elements which may appear multiple times, it inserts
'xsi:nil="true"' for each of those elements, which is a violation of my
schema (and logic).

(The code below is for cataloging laboratory instruments. The element
"calibrationtuid" is a globally unique identification string which refers to
a calibration curve.)

Desired XML output:
<adapters>
<adapter auid="e94e5c7c-1264-4720-9f92-fe7b1dc6d0d7">
<type>Heat Flux Gauge</type>
<subtype>Schmidt-Boelter</subtype>
<comment />
<serial>123ABC</serial>
<pt_units>kW m-2</pt_units>
<pt_upperrange>100</pt_upperrange>
<pt_lowerrange>0</pt_lowerrange>

<calibrationtuid>05f37bf1-5175-4db3-892b-608495c11b14</calibrationtuid>

<calibrationtuid>233c0bf5-1a56-4088-af1b-56d336555cac</calibrationtuid>
</adapter>
</adapters>

Obtained XML output:
<adapters>
<adapter auid="e94e5c7c-1264-4720-9f92-fe7b1dc6d0d7">
<type>Heat Flux Gauge</type>
<subtype>Schmidt-Boelter</subtype>
<comment />
<serial>123ABC</serial>
<pt_units>kW m-2</pt_units>
<pt_upperrange>100</pt_upperrange>
<pt_lowerrange>0</pt_lowerrange>
<calibrationtuid
xsi:nil="true">05f37bf1-5175-4db3-892b-608495c11b14</calibrationtuid>
<calibrationtuid
xsi:nil="true">233c0bf5-1a56-4088-af1b-56d336555cac</calibrationtuid>
</adapter>
</adapters>

How do I get ImportNode to stop inserting nil in these elements?
Mar 6 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.