# Solved: VB.net 2003, creating xml using DOM, set value



## Mike Beale (Oct 27, 1999)

Hi,

I'm creating some XML in VB.net 2003, using the DOM.

This is the XML I'm trying to create:
<items>
<item id="1" title="some title"><![CDATA[And here is the description]]></item>
<item id="2" title="Another one"><![CDATA[Description goes here]]></item>
</items>

Here is what I have so far:
Dim xmlDoc As New XmlDocument
xmlDoc.AppendChild(xmlDoc.CreateElement("", "items", ""))
Dim xmlRoot As XmlElement = xmlDoc.DocumentElement
 Dim xmlItem As XmlElement

xmlItem = xmlDoc.CreateElement("item")
With xmlItem
.SetAttribute("id", "1")
.SetAttribute("title", "some title")
End With
xmlRoot.AppendChild(xmlItem)

(in a loop for each item)

This gives me:
<items>
<item id="1" title="some title"></item>
<item id="2" title="Another one"></item>
</items>

But no way can I figure out how to add the text for the description.

Any ideas?

Thanks
Mike


----------



## Mike Beale (Oct 27, 1999)

For info, I have the solution from another forum:

xmlItem.AppendChild(xmlDoc.CreateCDataSection("And here is the description"))

This can be closed


----------

