XMLTextReader.ReadSubtree to return XMLTextReader

I am using XMLTextReader to process an XML file (as opposed to XMLDocument). I am using XMLTextReader, so I can use the parameter to ignore all spaces.

At some points I want to read into node using ReadSubtree. This returns XMLReader. How can I convert this to XMLTextReader so I can use the ignore spaces option.

+1


source to share


2 answers


I think you should use the XmlReader.ReadOuterXml () method to return the entire subtree as a string. Then you can use it to create the StringReader and use it again to create the XmlTestReader.

Awkward, but it should work.



A. By the way. ReadSubtree returns an XmlSubtreeReader that is obtained from an XmlReader, so you cannot directly pass it to the XmlTextReader.

+2


source


You can simply return the returned XmlReader as an XmlTextReader.



0


source







All Articles