I'v been reading and reading on this subject an from what iv got so far, you add a Node and then append elements to that new node which then appends to the parent node. My current schema for my xml document is as follows:

The Xml Structure is

<Queries>
<Query>
<Name> Query Name </Name>
<Action></Action>
<Text>

Query does something here

</Text>

<Parameters>
<Parameter>
<Name> Param Name </name>
etc...
</Parameter>
</Parameters>
</Query>
</Queries>


I basically am getting the above values from input via textbox input. What i want is to add a <Query> node with the values inputted from a textbox. Im just unsure of how to create this structure in vb.net... This is the code i have so far.

Public Sub AppendNewQuery(ByVal doc As XmlDocument)
Dim newQueryNode As XmlNode = QueryList.XMLDoc.CreateNode(XmlNodeType.Element, "Query", Nothing)
'newQueryNode.InnerText = "Text from Query Name TextBox"
Dim QueryName As XmlNode = QueryList.XMLDoc.CreateElement("Name")
QueryName.InnerText = NewQueryNameTXT.Text
Dim QueryAction As XmlNode = QueryList.XMLDoc.CreateElement("Action")
QueryAction.InnerText = NewQueryActionTXT.Text
Dim QueryText As XmlNode = QueryList.XMLDoc.CreateElement("Text")
QueryText.InnerText = QueryEditor.Text

newQueryNode.AppendChild(QueryName)
newQueryNode.AppendChild(QueryAction)
newQueryNode.AppendChild(QueryText)
QueryList.XMLDoc.DocumentElement.AppendChild(newQueryNode)
QueryList.XMLDoc.Save(My.Settings.QueryFile)

End Sub