INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

hi there, i have following xml file

hi there, i have following xml file

(OP)
hi there, i have following xml file.
i want to get data from this xml to my visual basic 6 program.
i try to use this:

Set oparser = CreateObject("msxml2.domdocument")
bRet = oparser.loadXML(str_xml)

If bRet Then
For i = 0 To celemi6.Length - 1
For j = 0 To celemi6(i).Attributes.Length - 1
MsgBox celemi6(i).Attributes.getNamedItem("PartNumber").Text
Next
Next
end if

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>

RE: hi there, i have following xml file

That's because you are looping through Attributes. You have no attributes here but childNodes!

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.

RE: hi there, i have following xml file

(OP)

can you give me the code please. how shoud i use childNodes?
thank you.

RE: hi there, i have following xml file

(OP)
any help please?

RE: hi there, i have following xml file

(OP)
actually i found following code i still need help :(
when i use the code i see total data i need data seperately.
i need help please.


Set list = xmlDoc.selectNodes("//Plan")
For i = 0 To list.Length - 1
For j = 0 To list.Item(i).childNodes.Length - 1
msgbox list.Item(i).childNodes.Item(j).baseName
msgbox list.Item(i).childNodes.Item(j).nodeTypedValue
next
next

i got following
1. message box -VehicleInfo
2. message box - BUS BA23K126 A235736 D09 10/07/2012 PP:201217|T3 Date:24/05/2012|Fassung Date:24/05/2012|Production Sequence:3|Customer:MAN KAMYON VE OTOBUES TIC. A.S|Country:TR

and next
1. message box -PartInfo
2. message box -81.94297.0249 BORU Hayır 1 078ET-Tutamaklar sarı RAL 1018 toz kaplamalı#

i wanna get all data one by one.
i really need your help, thank you.

RE: hi there, i have following xml file

(OP)
thank you mikrom. but i think you misunderstood me.
because when i looked at your post (the link) it is different from that i wanted to do.
i ll try to explain more about it.

<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>

i ll get this data in a master table to my database



<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>

these two <PartInfo> parts will be used in detail table to my database


so if i do this
Set list = xmlDoc.selectNodes("//Plan")
i got whole data not one by one

so if i do this
Set list = xmlDoc.selectNodes("//Plan/VehicleInfo")
i got data one by one but i cant make a relationship with <PartInfo>

so if i do this
Set list = xmlDoc.selectNodes("//Plan/PartInfo")
i got data one by one but i cant make a relationship with <VehicleInfo>

any hint please...

RE: hi there, i have following xml file

(OP)
my problem was solved by strongm (MIS)

CODE

Option Explicit

Private Sub CommandButton1_Click()
Dim oParser As DOMDocument
Dim Nodes As Object
Dim MyNode As IXMLDOMNode

Set oParser = New DOMDocument
oParser.LoadXML Text1.Text

For Each MyNode In oParser.ChildNodes
ScanNodes MyNode, 0
Next
End Sub

Private Sub ScanNodes(SourceNode As IXMLDOMNode, ByVal Indent As Long)
Dim MyNode As IXMLDOMNode

If SourceNode.NodeType <> NODE_ELEMENT Then
Debug.Print ": " & SourceNode.NodeValue;

Else
Debug.Print
Debug.Print String$(Indent, vbTab) & SourceNode.BaseName;
Indent = Indent + 1
For Each MyNode In SourceNode.ChildNodes
ScanNodes MyNode, Indent
Next
End If

End Sub


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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!

Resources

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