This is my requirement i need to deserialize an object and then i need to do some xml parsing(i know how it sounds)
So here is my codeXmlTextReader myFileReader = new XmlTextReader(path);
XmlSerializer serializer = new XmlSerializer(typeof(MyType));
MyType par = serializer.Deserialize(myFileReader) as MyType;
XElement qListenerParXml = XElement.Load(qL开发者_C百科istenerPar);
When i try to load the reader again i'm getting exception because the reader cursor is at the end. My question is how do i return it back to the beginning?
XmlTextReader
is forward-only, you cannot rewind the cursor on the data.
You could do this by going over the data again with a new instance of XmlTextReader
, or by loading it as an XmlDocument
.
精彩评论