Hi,
I have this XMLData. (SAMPLE ONLY)
XML1:
<text>This is a text
<i>great</i>
<ref>call this sample</ref>
Another text
<b>This is noted</b>
Underlying text
</text>
XML2:
<reference><r ef attr="8">Rare</ref><text>hello </text></reference>
------------
This block of code: (SAMPLE)
Appending the value of szTextList to a <XmlTextNode>
Although I can process the output, the output doesn't seem to be what I wanted it to be.
Here is the sample output:
<text>Thi s is a text
<i>great& lt;/i>
<reference&g t;<ref attr="8">Rar e</ref><text >hello< ;/text></reference>
Another text
<b>Thi s is noted</b>
Underlying text
<text>
which should be like this:
<text>This is a text
<i>great</i>
<reference><r ef attr="8">Rare</ref><text>hello </text></reference>
Another text
<b>This is noted</b>
Underlying text
</text>
And as I can see it is printing like a simple text not as nodes.
Although I can see how it ended like this (it is because it is a appended as a XmlText and not an XmlElement), I can't seem to find a way that it will retain it's nodes Value and Types as well.
Can anyone please advise about this?
Thanks,
aredz~
I have this XMLData. (SAMPLE ONLY)
XML1:
<text>This is a text
<i>great</i>
<ref>call this sample</ref>
Another text
<b>This is noted</b>
Underlying text
</text>
XML2:
<reference><r ef attr="8">Rare</ref><text>hello </text></reference>
------------
This block of code: (SAMPLE)
Code:
foreach (XmlNode xmlData in xmlTextLst)
{
if (xmlData.HasChildNodes)
{
for (int i = 0; i < xmlData.ChildNodes.Count; i++)
{
if (xmlData.ChildNodes[i].Name == "ref")
{
xmlData.ReplaceChild(xmlTempRoot, xmlData.ChildNodes[i]);
}
}
}
szTextList.Add(Convert.ToString(xmlData.InnerXml));
}
Code:
txtNode[iterator].AppendChild((XmlText)szTextList[iterator]);
Here is the sample output:
<text>Thi s is a text
<i>great& lt;/i>
<reference&g t;<ref attr="8">Rar e</ref><text >hello< ;/text></reference>
Another text
<b>Thi s is noted</b>
Underlying text
<text>
which should be like this:
<text>This is a text
<i>great</i>
<reference><r ef attr="8">Rare</ref><text>hello </text></reference>
Another text
<b>This is noted</b>
Underlying text
</text>
And as I can see it is printing like a simple text not as nodes.
Although I can see how it ended like this (it is because it is a appended as a XmlText and not an XmlElement), I can't seem to find a way that it will retain it's nodes Value and Types as well.
Can anyone please advise about this?
Thanks,
aredz~
Comment