locked
XML question RRS feed

  • Question

  •  

    Which is the best API to parse a huge XML document, to get parts of data from the XML document?

     

    Friday, September 21, 2007 9:48 AM

All replies

  •  

    Microsoft's XML parser is a COM component that comes with Internet Explorer 5 and higher. Once you have installed Internet Explorer, the parser is available to scripts.

    Microsoft's XML parser supports all the necessary functions to traverse the node tree, access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML.

     

    eg

    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async="false";
    xmlDoc.load("note.xml");
     
    or compare here different parsers with features
     
    http://www.xml.com/pub/rg/XML_Parsers
     
    Alternative check out this
    http://www.codeproject.com/tips/XMLParserGen.asp
    Friday, September 21, 2007 2:47 PM
  • I don't know what you mean by "huge". Huge is a relative word and we each have our definition for it.

     

    Anyway, assuming it is not that big, you can use the System.Xml.XmlDocument class in the .NET Framework 2.0. It gives you a great deal of flexibility and control over your XML document.

     

    If you are just looking to parse the data and if the file is indeed "huge", then I suggest you use the System.Xml.XmlReader class and store the throughputs to a System.Collections.Generic.Dictionary<T,T> class. The dictionary class is easily the fastest collection type if you are not bothered about sorting. It can manage literally manage millions of records quickly.

    Friday, September 21, 2007 6:47 PM