M
martin
Hi,
I would be extremly grateful for some help on producing an xml fragemt.
The fragment that I wish to produce should look like this
<Addresses>
<Address>&qout;Somebody's Name" <[email protected]></Address>
</Addresses>
This looks simple enough however I am having great difficulty getting the
string """ to appear in the above fragment.
The & sign alway get escaped to & so the line " always appears as
&quot; which is not what I require.
If I put in a " sign then the quote sign actually gets placed in the xml and
does not get escaped to " at all.
any help is producing a fragment in the above format whould be greatly
appreciated.
cheers
martin.
PS. to demonstate what I mean I have included the code below that can be
run from a console application/
Imports System.IO
Imports System.Xml
Module Module1
Sub Main()
Dim xmlDoc As New XmlDocument
Dim xmlElemAddress As XmlNode
Dim root As XmlElement
Try
xmlDoc.LoadXml("<Addresses/>")
xmlElemAddress = xmlDoc.CreateNode(XmlNodeType.Element, "Address", "")
xmlElemAddress.InnerText = ""Somebody's Name" <[email protected]>"
root = xmlDoc.DocumentElement
root.AppendChild(xmlElemAddress)
xmlDoc.Save(Console.Out)
Catch ex As Exception
Console.WriteLine("***ERROR***")
Console.WriteLine(ex.Message.ToString())
Finally
End Try
End Sub
I would be extremly grateful for some help on producing an xml fragemt.
The fragment that I wish to produce should look like this
<Addresses>
<Address>&qout;Somebody's Name" <[email protected]></Address>
</Addresses>
This looks simple enough however I am having great difficulty getting the
string """ to appear in the above fragment.
The & sign alway get escaped to & so the line " always appears as
&quot; which is not what I require.
If I put in a " sign then the quote sign actually gets placed in the xml and
does not get escaped to " at all.
any help is producing a fragment in the above format whould be greatly
appreciated.
cheers
martin.
PS. to demonstate what I mean I have included the code below that can be
run from a console application/
Imports System.IO
Imports System.Xml
Module Module1
Sub Main()
Dim xmlDoc As New XmlDocument
Dim xmlElemAddress As XmlNode
Dim root As XmlElement
Try
xmlDoc.LoadXml("<Addresses/>")
xmlElemAddress = xmlDoc.CreateNode(XmlNodeType.Element, "Address", "")
xmlElemAddress.InnerText = ""Somebody's Name" <[email protected]>"
root = xmlDoc.DocumentElement
root.AppendChild(xmlElemAddress)
xmlDoc.Save(Console.Out)
Catch ex As Exception
Console.WriteLine("***ERROR***")
Console.WriteLine(ex.Message.ToString())
Finally
End Try
End Sub