Re: LINQ to XML to Find Escaped Ampersand Problems?
Yes, you are correct! Forcing large sized XML document, we can combine
XmlReader and LINQ to XML to query the XML data, so as to decrease the
memory cost. For detail, please refer to the following code snippet:
using (XmlReader reader = XmlReader.Create("MyXml.xml"))
if (reader.NodeType == XmlNodeType.Element)
if (reader.Name == "subpart")
XElement ele = XElement.ReadFrom(reader) as XElement;
if (ele != null)
var query = from element in ele.DescendantNodesAndSelf()
where element.NodeType == System.Xml.XmlNodeType.CDATA
let CDataElement = element as XCData
foreach (var q in query)
For some additional references, please see
If you have any questions, please feel free to let me know.
Have a nice day!
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
This posting is provided "AS IS" with no warranties, and confers no rights.