views:

87

answers:

1

I tried writing some XML that has a line like:

<node attr="{foo}"/>

and loading it in C#, and getting:

System.Xml.XmlException: Name cannot begin with the '{' character, hexadecimal value 0x7B. Line 2, position 14.

I tried escaping with &#x7b;, but that just gives:

System.Xml.XmlException: Name cannot begin with the '&' character, hexadecimal value 0x26. Line 2, position 14.

(I'm no expert on XML, and I had thought I didn't need to escape anything in an attribute except ". I tried looking on google and SO, and didn't find anything obvious. I even tried looking in the XML spec, but everything there is so ridiculously abstract and generic I can't actually tell when I have to escape something, or how to escape it.)

What characters do I have to escape in an XML attribute value? And how exactly do I escape them?

A: 

Aw, crap, I'm an idiot. Found the error. Sorry for the mess.

(How can I close/delete this?)

Ken
Click the delete button, below the tags below the question
Andomar
Don't be too hard on yourself.... we all do that sometimes, even with 30 years experience :-)
Jim Garrison