about String convert XmlReader

  • Thread starter Thread starter dongxm
  • Start date Start date
D

dongxm

XslTransform xslt = new XslTransform();
xslt.Load(myXmlReader)

the myXmlReader is a XmlReader,but i have String of xsl file's content...
how to do,String convert XmlReader?

thanks
 
dongxm said:
XslTransform xslt = new XslTransform();
xslt.Load(myXmlReader)

the myXmlReader is a XmlReader,but i have String of xsl file's content...
how to do,String convert XmlReader?
Its a bit of a pain. Basically you need to create a StringReader and create
the XmlReader around that

StringReader sr = new StringReader(<string>);
XmlReader myXmlReader = new XmlTextReader(sr);

You may also have to use XML encoded to unicode instead of UTF8 since I
believe StringReader always returns unicode bytes(which means the encoding
attribute has to be properly set).
 
Back
Top