Unstructured XML via non-tab deliminator?

后端 未结 5 1305
栀梦
栀梦 2020-12-15 13:43

We have a complex XML Structure and really a big one (>500 MB). the XSD of the structure is: This XSD

As we know this is a complex one. and because of size or non-t

5条回答
  •  感动是毒
    2020-12-15 14:48

    Just to add an alternative version,

    while (reader.Read())
    {
        if (reader.NodeType == XmlNodeType.Element &&  reader.Name == "product")
        {                   
            var productElement = XElement.ReadFrom(reader);
    
            // use element
            string productName = productElement.Element("name").Value;
        }
    }
    

    The XElement class is from System.Xml.Linq , I find it the easiest way to deal with XML (without full deserialization to a class).

提交回复
热议问题