Tom Fields wrote:
But in some cases, I need the '&' as '&' and not as &.
Example: <glyph unicode="L"/>
Some code-snippet:
XmlDocument ^ doc = gcnew XmlDocument();
....
XmlAttribute ^ a = doc->CreateAttribute("unicode");
a1->Value = ??? - what to write here?
...
Stream ^ fs = gcnew FileStream(filename, FileMode::Create);
...
XmlWriter^ writer = gcnew XmlTextWriter(fs, gcnew UTF8Encoding);
How can I force to write the attribute as L and not as &x4c;?
What programming language is that? You simply need to set the Value
property to a string with the Unicode characters you need, with C# or J#
you could simply use e.g.
"\u004C"
to have that character in a string literal.
Or you can simply use
"L"
as that is the character with the Unicode code point 76.
There is no need to escape such characters and there is no easy way to
use XmlDocument or XmlTextWriter to enforce escaping of such characters,
you would need your own custom XmlWriter that escapes the characters you
need.
The DOM does not preserve such numeric characters references, it always
gives you the character itself and not the reference.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/