Christoph
Thanks for the response. I thought that was the case (strings are
utf-16), so perhaps this is an interop problem. The XML string I'm
generating is being fed to QuickBooks via their QBXML interface (which is
COM interop). The string generated via the XMLTextWriter has utf-16
specified in the xml header; while the string generated by the OuterXML
property of an XMLDocument does not. If they are both in fact utf-16 then
it must (or may) be the utf-16 in the XML header that is causing the
problem.
I wonder if that would inhibit conversion to utf-8 (or ASCII) as the string
is converted for use as a string argument to a COM object?
Bill
"Christoph Schittko [MVP]" <christophdotnetINVALID@austin.rr.com> wrote in
message news:%23Zjjfg8EEHA.2416@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view] > Bill,
> strings are always utf-16 encoded. You can use a StreamWriter over a
> MemoryStream if you need a different character encoding. Check the group
> archives for some examples.
>
> --
> HTH
> Christoph Schittko [MVP]
> Software Architect, .NET Mentor
>
> "Bill Cohagan" <bill@teraXNOSPAMXquest.com> wrote in message
> news:ebkpIl5EEHA.696@TK2MSFTNGP12.phx.gbl...
> > I'm trying to generate an XML document within a string. I can do this
> using
> > the XmlDocument class and it's CreateElement, etc. methods, then at the
> end
> > I reference the OuterXML property and I've got it.
> >
> > What I'd like to do (for various reasons) is to use an XMLTextWriter
> instead
> > of the DOM, but I can't figure out how to do this without going to a
file.
> > I've tried creating the XMLTextWriter around a StringWriter and that
> works,
> > but produces utf16. I don't see any way of overriding this using the
> > StringWriter. What am I missing?
> >
> > BTW, the problem is that the consumer of the XML can't handle utf-16.
> >
> > Thanks in advance,
> > Bill
> >
> >
>
>