XML Node Error
Hi everyone
I need to read in an xml file and add it to the db, but for some reason, its not
picking up the nodes, I might be overlooking something.
the basic structure of the xml looks like this:
Code:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<ISBN_KEY>xxxx</ISBN_KEY>
<ISBN>xxxx</ISBN>
<EXTENT>xx</EXTENT>
<ILLUSTRATIONSxxx</ILLUSTRATIONS>
<TRIM_METRIC>xxxxx</TRIM_METRIC>
</ROW>
<ROW num="2">
<ISBN_KEY>xxxx</ISBN_KEY>
<ISBN>xxxx</ISBN>
<EXTENT>xx</EXTENT>
<ILLUSTRATIONSxxx</ILLUSTRATIONS>
<TRIM_METRIC>xxxxx</TRIM_METRIC>
</ROW>
<ROW num="3">
<ISBN_KEY>xxxx</ISBN_KEY>
<ISBN>xxxx</ISBN>
<EXTENT>xx</EXTENT>
<ILLUSTRATIONSxxx</ILLUSTRATIONS>
<TRIM_METRIC>xxxxx</TRIM_METRIC>
</ROW>
</ROWSET>
and I am reading it with this, but its not showing me the msgbox?
Code:
'--Create MSXML 4.0 DOM Object and initialize it
Set objXMLDOM = CreateObject("MSXML2.DOMDocument.4.0")
objXMLDOM.validateOnParse = False
'--Load the XML file
objXMLDOM.load "C:\Documents and Settings\Jako\Desktop\XML Process\export.xml"
Set objNodes = objXMLDOM.selectNodes("/ROWSET/ROW")
'--Add records
For Each objNodeItem In objNodes
msgbox objNodeItem.selectSingleNode("ISBN_KEY").nodeTypedValue
Write_RecordToDB objNodeItem, strCurFileName
Next
Set objXMLDOM = Nothing
I am using the exact same code for another xml file, but there the structure is a bit different, I think it might be the row num=x part that is causing the problems?
Any ideas?
Thanks.
noFriends, June 3rd, 2008 08:30 AM
Bookmarks