Altova Mailing List Archives


Re: Parsing large XML files FAST

From: "PedroX" <info@--------.--->
To: NULL
Date: 6/26/2005 1:36:00 PM
I can't believe that my ISP (read: SYMPATICO.CA), which is the biggest
communications monopoly in Canada, forces me half the time to resort to
google to post on usenet.  They suck, they just suck, and they'll keep
on sucking forever.  Anyway ... back to my XML issue....

I've installed .net, and searched documentation that would explain the
use
of XmlTextReader.
But I guess I cannot just skip the ABC of ASP.Net . Most of the scripts
are
in C , and sometimes, there's no
indication of what scripting language is used. Can someone post an
equivalent of the code below using in ASP.NET and
the XmlTextReader? I am really stuck, and I don't have the time, the
energy
and the brains to re-invent the wheel.
Thanks in advance.


'------- XML OBJECT ---------

Set objXMLDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")
objXMLDoc.async = false
objXMLDoc.setProperty "SelectionLanguage", "XPath"
objXMLDoc.setProperty "SelectionNamespaces", " ... etc ..."

strURL = "D:\wwwroot\webdir\odp_split\CD_01\odp_content_002.xml"

'--- load XML
bLoadResult = objXMLDoc.load(strURL)

'--- get number of nodes I want to loop

Set oNode = objXMLDoc.selectNodes("//node_name")

For a = 1 to oNode.length

  '-- Get some data I need from each node ---
  Set oNode = objXMLDoc.selectSingleNode("//node_name[" & a
&"]/node_value")

  '--- insert in DB. Commands for Connection to DB, etc are assumed

  strSQL = "INSERT INTO MyTable (Field1) VALUES ('"&ioNode.text&"')"

  oConn.Execute(strSQL)

Next

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.