Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's what I ended up doing:</p> <pre><code>Public Function FormatMessage(ByVal author As String, ByVal title As String, ByVal genre As String) As String Dim xDoc As New XmlDocument ' Create outer XML Dim xNode As XmlNode = xDoc.AppendChild(xDoc.CreateElement("xml")) ' Create Author Node Dim xAuthor As XmlNode = xNode.AppendChild(xDoc.CreateElement("author")) xAuthor.InnerText = author ' Create Message Node Dim xTitle As XmlNode = xNode.AppendChild(xDoc.CreateElement("message")) xtitle.InnerText = title ' Create Genre Node Dim xGenre As XmlNode = xNode.AppendChild(xDoc.CreateElement("genre")) xGenre.InnerText = genre ' Create StringWriter to convert XMLDoc to string Dim xWriter As New IO.StringWriter() Dim xml_writer As New XmlTextWriter(xWriter) xDoc.WriteContentTo(xml_writer) Return xWriter.ToString End Function </code></pre> <p>This function builds the xml string based on the input values, then to break the xml string back down into the original values, I used this:</p> <pre><code>Dim author As String Dim title As String Dim genre As String Dim xDoc As New XmlDocument Dim xAuthor As XmlElement Dim xTitle As XmlElement Dim xGenre as XmlElement xDoc.LoadXml(xml) If xDoc.DocumentElement.Name = "xml" Then xAuthor = xDoc.FirstChild.Item("author") xTitle = xDoc.FirstChild.Item("title") author = xAuthor.FirstChild.Value title = xTitle.FirstChild.Value genre = xGenre.FirstChild.Value End If ShowMessage(author, title, genre) </code></pre> <p>Thanks for the help! KJ</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload