I am creating a webservice that has a webmath returning the dataset object.
A problem XML tags are not written when its associated value is empty.
A simple example will be followed:
ID name text - ------------------- 1 Nell Test 1 & Lt; ------- Null Value 2 to Two Test 2 3 Tata Test 3
is XML-serialed:
& lt; Table line command = "1" & gt; & Lt; ID & gt; 1 & lt; / Id & gt; & Lt; ----- Element missing when value = null & lt; Text & gt; Test1 & lt; / Text & gt; & Lt; / Table & gt; & Lt; Table line command = "2" & gt; & Lt; ID & gt; 2 & lt; / Id & gt; & Lt; Name & gt; Toto & lt; / Name & gt; & Lt; Text & gt; Test2 & lt; / Text & gt; & Lt; / Table & gt; & Lt; Table line command = "3" & gt; & Lt; ID & gt; 3 & lt; / Id & gt; & Lt; Name & gt; Tata & lt; / Name & gt; & Lt; Text & gt; Test3 & lt; / Text & gt; & Lt; / Table & gt;
This is giving me problems when I hook this XML into the reporting services if any element of the first line is empty, it will not recognize it as a report field and the result The entire column is missing from.
Is there any way to force XML serialization to be inserted into empty elements if its associated value is empty?
EX:
& lt; Table line command = "1" & gt; & Lt; ID & gt; 1 & lt; / Id & gt; & Lt; Name & gt; & Lt; / Name & gt; & Lt; ---- Empty element for zero element & lt; Text & gt; Test1 & lt; / Text & gt; & Lt; / Table & gt;
thanks
You changed the SQL to return empty string
[edit] If it is not, then select
select collases (name, '') from table_name;
[edit] One option may be another (rather ugly) way.
- Create another blank dataset with the schema extracted from the original dataset.
- In this dataset, through the tapable columns, repeat and set a
DefaultValue
. - Load the XML generated from the first dataset into this dataset (just data, not schema again).
- Generate XML Datasets from another.
John!
[edit 2] Or you can just repeat through a dataset and make XML itself.
Comments
Post a Comment