By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,988 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,988 IT Pros & Developers. It's quick & easy.

Read Node values from xml inVB

P: 1
hi,
i wanna read the node values from xml. As per my code i can read the node values in first child node and for the next node am not able to read the node values. pls help me.
i'll paste the code below:

Sub readfile()

objxmldom.async = False
objxmldom.Load ("D:\CRT\rules\AQUA.xml")


On Error GoTo ErrorHandler:

Dim nodevalue, node1, nodevalue2, nodevalue3
Set objnodes = objxmldom.selectNodes("/Coors_Rules")
For Each OBJBOOKNODE In objnodes

If OBJBOOKNODE.selectNodes("CATEGORY").length <> 0 Then
MsgBox OBJBOOKNODE.selectNodes("CATEGORY").length
For j = 0 To OBJBOOKNODE.selectNodes("CATEGORY").length

node1 = OBJBOOKNODE.selectNodes("CATEGORY").Item(J).Attrib utes.getNamedItem("TYPE").nodeTypedValue
MsgBox node1

If node1 = "NAMING" Then
MsgBox OBJBOOKNODE.selectSingleNode("CATEGORY").selectNod es("OBJRULE").length
For i = 0 To OBJBOOKNODE.selectSingleNode("CATEGORY").selectNod es("OBJRULE").length

node2 = OBJBOOKNODE.selectSingleNode("CATEGORY").selectNod es("OBJRULE").Item(i).Attributes.getNamedItem("OBJ NAME").nodeTypedValue

MsgBox node2
NODES(1) = OBJBOOKNODE.selectSingleNode("CATEGORY").selectNod es("OBJRULE").Item(i).Attributes.getNamedItem("PRO PERTY").nodeTypedValue
MsgBox NODES(1)
NODES(2) = OBJBOOKNODE.selectSingleNode("CATEGORY").selectNod es("OBJRULE").Item(i).Attributes.getNamedItem("VAL UE").nodeTypedValue
MsgBox NODES(2)
NODES(3) = OBJBOOKNODE.selectSingleNode("CATEGORY").selectNod es("OBJRULE").Item(i).Attributes.getNamedItem("SEV ERITY").nodeTypedValue
MsgBox NODES(3)
Next
End If

End If

Next OBJBOOKNODE



Exit Sub ' Exit to avoid handler.

ErrorHandler: ' Error-handling routine.
End
End Sub


my xml file is like tis:

- <Coors_Rules CREATION_DATE="18.12.2007" VERSION="1.0">
- <CATEGORY TYPE="NAMING" DESCRIPTION="NAMING STANDARDS">
<OBJRULE OBJNAME="RDB_SOURCE_SEQUENCES" PROPERTY="START_VALUE" VALUE="7" SEVERITY="ERROR" />
<OBJRULE OBJNAME="VIEW_INGRP" PROPERTY="END_VALUE" VALUE="6" SEVERITY="WARNING" />
</CATEGORY>
- <CATEGORY TYPE="DOCUMENTATION" DESCRIPTION="DOCUMENTATION STANDARDS">
<OBJRULE OBJNAME="MAPPING" PROPERTY="MIN_CHARS" VALUE="1" SEVERITY="ERROR" />
<OBJRULE OBJNAME="OPERATORS" PROPERTY="MIN_CHARS" VALUE="2" SEVERITY="ERROR" />
</CATEGORY>
</Coors_Rules>

The actual issue is am able to read the first child type="naming" and not the second chile type="Documentation"
PLS REPLY AS SOON AS POSSIBLE. AND TOO URGENT!!
THANKS
Dec 28 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.