|
-
Jul 21st, 2001, 10:39 AM
#1
Thread Starter
Addicted Member
XML Experts, pls Help...
I'm having some trouble with XML. In my application, I have a combo box populated with all of the Presentation_Name element's text added to the combo box. Now, when I select a presentation name from the combo box, another combobox right below the first one, gets populated with all of the messages that fall under the Presentation_Name. For Example, if I select Return Policy from the combo box, the combo box below it gets populated with only one message, "CC Regarding return policy"
This is what I got so far:
Thank You
Code:
Option Explicit
Dim xmlNote As New DOMDocument
Dim xmlNode As IXMLDOMNode
Private Sub PopulateAddNotes()
'// Load XML into DOM Object
xmlNote.Load "C:\Notes.xml"
'// Populate combo box with all presentation names
For Each xmlNode In xmlNote.documentElement.selectNodes("//PRESENTATION_NAME")
Combo1.AddItem xmlNode.Text
Next
End Sub
Private Sub Combo1_Click()
Dim strNoteType As String
Dim xmlNodeList As IXMLDOMNodeList
strNoteType = Combo1.Text
Set xmlNodeList = xmlNote.documentElement.selectNodes("//PRESENTATION_NAME")
For Each xmlNode In xmlNodeList
If xmlNode.Text = strNoteType Then
Combo2.AddItem xmlNode.parentNode.selectSingleNode("MESSAGES/MESSAGE/COMBO_NAME").Text
Text1.Text = xmlNode.parentNode.selectSingleNode("MESSAGES/MESSAGE/TEXT_NAME").Text
End If
Next
End Sub
Code:
<NOTES>
<NOTE ID="104">
<PRESENTATION_NAME>Return Policy</PRESENTATION_NAME>
<MESSAGES>
<MESSAGE>
<COMBO_NAME>CC Regarding return policy</COMBO_NAME>
</MESSAGE>
</MESSAGES>
<PRESENTATION_NAME>Delivery Inquiry</PRESENTATION_NAME>
<MESSAGES>
<MESSAGE>
<COMBO_NAME>CC Regarding delivery timing</COMBO_NAME>
</MESSAGE>
<MESSAGE>
<COMBO_NAME>CC Regarding delivery options</COMBO_NAME>
</MESSAGE>
<MESSAGE>
<COMBO_NAME>CC Regarding delivery fees</COMBO_NAME>
</MESSAGE>
</MESSAGES>
</NOTE>
</NOTES>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|