Writing and editing xml in visual basic with visual studio express 2012

  • Thread starter Thread starter jrfall
  • Start date Start date
J

jrfall

Guest
I am having some issues getting a program I am trying to write to work. I have code that looks like this(though I have omitted some of the xml elements for brevity):

Dim document As XDocument =
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Root>
<Controller>
<Program>
<Routine>
<Content>
<Entry Number="0
<Comment><![CDATA[sometext]]></Comment>
<Text><![CDATA[someothertext]]></Text>
</Entry>
</Content>
</Routine>
</Program>
</Controller>
</Root>

My goal is to create a document with that basic structure, but be able to add <Entry> nodes, and edit the <Comment> and <text> CDATA in those nodes. I can create the document, no problem, but I cant seem to get any elements to write to the file (using document.Save("myxml.xml")) after all the work is done

I have tried

For Each content As XElement In From element In doc.<Root>.<Controller>.<Program>.<Routine>.<Content>
rll.Add(New XElement("Entry1"))
Next

Any suggestions?

Im fairly new to xml and vb, so bear with me please.

Continue reading...
 
Back
Top