I have an XDocument which contains embedded values:
<name>
<firstname><%= firstname %></firstname>
<lastname><%= lastname %></lastname>
</name>
when this appears in the body of my code, it works entirely as expected
e.g.
Dim strfirstname = "John"
dim strastname = "Smith"
Dim NameXML = <name>
<firstname><%= strfirstname %></firstname>
<lastname><%= strlastname %></lastname>
</name>
Debug.Print(NameXML.ToString)
produces
<name>
<firstname><John></firstname>
<lastname><Smith></lastname>
</name>
However, I would like to save my XDocument to an .xml file (it is a bit longer than this example), load it at run-time and produce the same result as above.
e.g.
Dim NameXML = XDocument.Load("/names.xml")
Debug.Print(NameXML.ToString)
This produces an error:
"Name cannot begin with the '%' character"
I have also tried loading the XDocument as a string:
Dim strNames = My.Computer.FileSystem.ReadAllText("\names.xml")
Dim NameXML = XDocument.Parse(template)
but I get the same error.
Is it possible to load the XDocument, complete with all embedded values? Or must it remain in my code to work?
Thanks!