Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Encoding Problem >Thread Next - Re: Encoding Problem Re: Encoding ProblemTo: NULL Date: 2/5/2008 6:10:00 AM On Feb 5, 5:33=A0am, Martin Honnen <mahotr...@yahoo.de> wrote:
> 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:
> =A0 =A0 =A0 =A0XmlDocument doc =3D new XmlDocument();
> =A0 =A0 =A0 =A0doc.LoadXml(@"<root><foo>bar</foo></root>");
> =A0 =A0 =A0 =A0XmlDocumentFragment fragment =3D doc.CreateDocumentFragment=
();
> =A0 =A0 =A0 =A0fragment.InnerXml =3D "<a>hi</a><b>bye</b>";
> =A0 =A0 =A0 =A0doc.DocumentElement.AppendChild(fragment);
> =A0 =A0 =A0 =A0doc.Save(Console.Out);
>
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML
> =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/
I'm using MSXML. I was afraid I would have to do that. Thanks!
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
