What would be the best practice to escape ’ and " when creating XMLTextNode? Other predefined entities (<, > and &) are escaped automatically. Doing this:
Dim t As String = "O'Malley"
xml.CreateTextNode( t.ReplaceAll( "'", "'") )
only results to O&apos;Malley
You should not need to escape it.
That is done automatically by xml library.
[quote=421228:@Christian Schmitz]You should not need to escape it.
That is done automatically by xml library.[/quote]
I agree that it should go like this. But this code snippet:
[code]Dim x As New XmlDocument
x.AppendChild( x.CreateTextNode( “<>&’”"" ) )
Dim s As String = x.ToString
[/code]
I wonder what I’m doing wrong when s gets set to
<?xml version="1.0" encoding="UTF-8"?><>&'"
Quotes don’t usually need to be escaped in nodes. There are some instances in which they do, but in your example above, the quotes are safe to be used un-escaped. Reference
Are you seeing some kind of issue with reading the XML after it has been generated by the Xojo?
[quote=421243:@Tim Parnell]Quotes don’t usually need to be escaped in nodes. There are some instances in which they do, but in your example above, the quotes are safe to be used un-escaped. Reference
Are you seeing some kind of issue with reading the XML after it has been generated by the Xojo?[/quote]
The other end receiving the XML I’m creating requires to escape the quotes.