![]() |
| |||||||
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
| |||
| 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>
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
Any ideas? Thanks. |
| Sponsored Links |
| ||||
| Is this Visual Basic or VbScript? Everything here seems to be right and I don't think the node attributes num="1", num="2", etc. would be having any effect on it. Maybe there is an error not being reported? Try this: Code: '--Create MSXML 4.0 DOM Object and initialize it
Set objXMLDOM = CreateObject("MSXML2.DOMDocument.4.0")
objXMLDOM.validateOnParse = False
'--Load the XML file
If objXMLDOM.load("C:\Documents and Settings\Jako\Desktop\XML Process\export.xml") Then
Set objNodes = objXMLDOM.selectNodes("/ROWSET/ROW")
'--Add records
For Each objNodeItem In objNodes
msgbox objNodeItem.selectSingleNode("ISBN_KEY").nodeTypedValue
Write_RecordToDB objNodeItem, strCurFileName
Next
Else
msgbox objXMLDOM.parseError.reason
End If
Set objXMLDOM = Nothing
__________________ jmurrayhead Did I help you out? Make me popular by clicking the icon!If you found a post helpful, please click the button in the lower right-hand corner of the post.Powered by ASP.Net |
| |||
| Hi J yeah, I had some error parsing code in, but I thought that if I left it out it should still process it? It has some invalid chars it seems, like: Timæus and Caraël but the later shouldn't make it crash? I am a real n00b with xml, please halp ![]() |
| ||||
| Those characters shouldn't be a problem. XML documents can contain non ASCII characters, like Norwegian æ ø å , or French ê è é. Take a look here as far as XML encoding errors are concerned: XML Encoding I made some changes here, see if this works: Code: '--Create MSXML 4.0 DOM Object and initialize it
Set objXMLDOM = CreateObject("MSXML2.DOMDocument.4.0")
objXMLDOM.validateOnParse = False
'--Load the XML file
If objXMLDOM.load("C:\Documents and Settings\Jako\Desktop\XML Process\export.xml") Then
Set objNodes = objXMLDOM.documentElement.selectNodes("/ROWSET/ROW")
'--Add records
For Each objNodeItem In objNodes
msgbox objNodeItem.selectSingleNode("ISBN_KEY").nodeTypedValue
Write_RecordToDB objNodeItem, strCurFileName
Next
Else
msgbox objXMLDOM.parseError.reason
End If
Set objXMLDOM = Nothing
|
| The Following User Says Thank You to jmurrayhead For This Useful Post: | ||
noFriends (June 3rd, 2008) | ||
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wizard1 error The command 'MoveComplete' is not valid | peebman2000 | .Net Development | 10 | April 28th, 2008 02:52 PM |
| [Error] Microsoft JET Database Engine error '80004005' Operation must use an updatea | theChris | ASP Development | 2 | March 16th, 2008 10:18 AM |
| Sponsored Links |
| ASP.NET Resource Index a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer. Free Web Directory Including Chats and Forums Resources, Offer automatic, instant and free directory submissions. | URLZ Web Directory URLZ Web Directory Free Web Directory - Add Your Link The Little Web Directory | Free Web Directory Pegasus free web directory is a free directory organised by categories. Web Directory & SEO Services dirroot web directory |