Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Encoding Problem >Thread Next - Re: Encoding Problem Re: Encoding ProblemTo: NULL Date: 2/5/2008 11:33:00 AM
BillGatesFan wrote:
> Why can't I do this?
>
> a.CreateTextNode("<a>hi</a><b>bye</b>")
>
>
>
> It comes out like "%ltagt% .....
It would result in "<a>...".
> How can I fix this?
Well don't create a text node, parse that string into nodes. How you do
that depends on the API you are using.
If you let us know whether you use MSXML or .NET then we can tell you
more. With .NET it is easy, if you create a new document, use LoadXml,
if you want to parse additional markup, use an XmlDocumentFragment and
set its InnerXml:
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"<root><foo>bar</foo></root>");
XmlDocumentFragment fragment = doc.CreateDocumentFragment();
fragment.InnerXml = "<a>hi</a><b>bye</b>";
doc.DocumentElement.AppendChild(fragment);
doc.Save(Console.Out);
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
