I have something like this:
<?xml version="1.0" encoding="utf-8"?>
<Data>
<ConfigDatas>
<ArrayOfConfigData xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BTTest.Models">
<ConfigData>
<id>4</id>
<ip>111111</ip>
<port>34</port>
</ConfigData>
<ConfigData>
<id>0</id>
<ip>222222</ip>
<port i:nil="true" />
</ConfigData>
</ArrayOfConfigData>
</ConfigDatas>
<OtherTypeDatas>
<ArrayOfConfigData ...>
....
</ArrayOfConfigData>
<OtherTypeDatas>
</Data>
I would like to parse the xml, getting ConfigDatas and OtherTypeDatas nodes (I can do this just with read), but then when I get for example ConfigDatas node be able to read all ArrayOfConfigData Node text at once. Is this possible?
XmlTextReader is designed to iterate through an XML document. This is very memory efficient, as you do not create an in-memory representation of the whole document at once. If you have very large XML documents, it is essential to process them in this manner.
If you want to have the whole XML loaded so that you can e.g. use XPath queries, use XmlDocument or XDocument instead, depending on your exact needs.