Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...These forums are an excellent source and example of the way people can help each other..."

Geography

Where in the world do Tek-Tips members come from?
kennedymr2 (Programmer)
27 Jun 12 2:20
This is the abreviated xml
'*************************

<Pool Type="XX" Available="Y">
<Dividend Id="629" Amount="12.8000">
<DivResult No="1" RNo="2"/>
</Dividend>
<Dividend Id="6291" Amount="13.8000">
<DivResult No="1" RNo="4"/>
</Dividend>
</Pool>

VB6 Code.... working ok

Set oxmlNodeList = xmldoc.selectNodes("//Pool")

For intNode = 0 To oxmlNodeList.length - 1
For intAttr = 0 To oxmlNodeList(intNode).Attributes.length - 1
List2.AddItem oxmlNodeList(intNode).Attributes.getNamedItem("Type").Text
Next
'*** This is where i need to get NO & Rno ie Pick up both DivResults
'Ie I need some child code of some sort ??????
'eg List2.AddItem XX,12.80,1,2
' List2.AddItem XX,13.80,1,4

Next


NOT THIS *********

Set oxmlNodeList = xmldoc.selectNodes("//Pool/Dividend")

For intNode = 0 To oxmlNodeList.length - 1
For intAttr = 0 To oxmlNodeList(intNode).Attributes.length - 1
List2.AddItem oxmlNodeList(intNode).Attributes.getNamedItem("Id").Text
List2.AddItem oxmlNodeList(intNode).Attributes.getNamedItem("Amount").Text
Next
Next


Really appereciate any help

Regards Kennedymr2
Helpful Member!  strongm (MIS)
2 Jul 12 10:36

CODE


    Dim xmldoc As New DOMDocument60
    Dim oxmlNodeList As IXMLDOMNodeList
    Dim oxmlSubNodes As IXMLDOMNodeList
    
    Dim node As IXMLDOMNode
    Dim SubNode As IXMLDOMNode
    
    xmldoc.loadXML Text1.Text
    
    Set oxmlNodeList = xmldoc.selectNodes("//Pool/Dividend")
    
    For Each node In oxmlNodeList
        Debug.Print node.Attributes.getNamedItem("Id").Text
        Debug.Print node.Attributes.getNamedItem("Amount").Text
        Set oxmlSubNodes = node.selectNodes("DivResult")
        For Each SubNode In oxmlSubNodes
            Debug.Print SubNode.Attributes.getNamedItem("No").Text
            Debug.Print SubNode.Attributes.getNamedItem("RNo").Text
        Next
        Debug.Print
    Next 
kennedymr2 (Programmer)
2 Jul 12 18:08
strongm (MIS)...

Thanks once again for the help, much appreciated...i did not think of subnode...

Thanks also for the help you have offered me over the years with various other questions ...

Regards Kennedymr2
baran121 (Programmer)
13 Jul 12 6:41
i am sorry to write here, but i have similar problem.

xml file is below.
i want to get data from this xml to my visual basic 6 program.
i try to use this:

xmldoc.loadXML str_xml

Set oxmlNodeList = xmldoc.selectNodes("//Plan/PartInfo")

For Each node In oxmlNodeList
' Set celemi1 = node.Attributes.getNamedItem("Chassis")
' MsgBox oxmlNodeList.Length - 1
Set Indent = node.ownerDocument.createTextNode(vbNewLine & String(0, vbTab))

Set oxmlSubNodes = node.selectNodes("//Plan/PartInfo")
For Each SubNode In oxmlSubNodes
MsgBox oxmlSubNodes.Length - 1
Set celemi2(SubNode).Text = SubNode.Attributes.getNamedItem("PartNumber").Text
MsgBox celemi2(SubNode).Text
Next
Debug.Print
Next


but there is a problem, because i cant get sub info from xlm file.
just first <PartInfo>
i wanna get data all <PartInfo> for each <Plan>
i need your help,
thank you...

<Plan>
<VehicleInfo>
<VehicleGroup>BUS</VehicleGroup>
<VehicleCode>BA23K126</VehicleCode>
<Chassis>A235734</Chassis>
<ShipTo>G03</ShipTo>
<DueDate>10/07/2012</DueDate>
<Note>PP:201217|T3 Date:24/05/2012|Fassung Date:24/05/2012|Production Sequence:2|Customer:MAN KAMYON VE OTOBUES TIC. A.S|Country:TR</Note>
</VehicleInfo>
<PartInfo>
<PartNumber>88.76240.0030</PartNumber>
<PartDescription>BAGLANTI CITASI</PartDescription>
<SupplierPartNumber/><SupplierPartDescription/>
<Consignment>Hayır</Consignment>
<Quantity>4</Quantity>
<PartNote>:078ET-Tutamaklar sarı RAL 1018 toz kaplamalı#</PartNote>
</PartInfo>
<PartInfo>
<PartNumber>88.76240.6001</PartNumber>
<PartDescription>BAGLANTI CITASI</PartDescription>
<SupplierPartNumber/><SupplierPartDescription/>
<Consignment>Hayır</Consignment>
<Quantity>4</Quantity>
<PartNote>:078ET-Tutamaklar sarı RAL 1018 toz kaplamalı#</PartNote>
</PartInfo>
</Plan>
strongm (MIS)
13 Jul 12 8:03

CODE

    Set oxmlNodeList = xmldoc.SelectNodes("//Plan/PartInfo")
    
    For Each node In oxmlNodeList
        Debug.Print node.nodeName
        For Each SubNode In node.ChildNodes
            Debug.Print vbTab & SubNode.BaseName & ": " & SubNode.Text
        Next
        Debug.Print
    Next 

baran121 (Programmer)
13 Jul 12 8:52
thank you strongm very much.

but i need little more help.


<VehicleInfo>
<VehicleGroup>BUS</VehicleGroup>
<VehicleCode>BA23K126</VehicleCode>
<Chassis>A235734</Chassis>
<ShipTo>G03</ShipTo>
<DueDate>10/07/2012</DueDate>
<Note>PP:201217|T3 Date:24/05/2012|Fassung Date:24/05/2012|Production Sequence:2|Customer:MAN KAMYON VE OTOBUES TIC. A.S|Country:TR</Note>
</VehicleInfo>


this part is my master table information


<PartInfo>
<PartNumber>88.76240.0030</PartNumber>
<PartDescription>BAGLANTI CITASI</PartDescription>
<SupplierPartNumber/><SupplierPartDescription/>
<Consignment>Hayır</Consignment>
<Quantity>4</Quantity>
<PartNote>:078ET-Tutamaklar sarı RAL 1018 toz kaplamalı#</PartNote>
</PartInfo>
<PartInfo>
<PartNumber>88.76240.6001</PartNumber>
<PartDescription>BAGLANTI CITASI</PartDescription>
<SupplierPartNumber/><SupplierPartDescription/>
<Consignment>Hayır</Consignment>
<Quantity>4</Quantity>
<PartNote>:078ET-Tutamaklar sarı RAL 1018 toz kaplamalı#</PartNote>
</PartInfo>


this part is my datail table information.

i think i need two for next .
thank you again.


baran121 (Programmer)
13 Jul 12 19:44
any help please...

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close