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

nextsibling grief

nextsibling grief

(OP)
vb.net VS 2012


<?xml version="1.0" encoding="UTF-8"?>
-<XMLRateQuote xmlns="http://vitranexpress.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ExtraServices>ISP,HTA</ExtraServices>
//list is shortened for your viewing pleasure

-<ExtraServiceBreakdown>-
<XMLAccessorial>
<Id>ISP</Id>
<Description>Inside Pickup Fee</Description>
<Cost>124.45</Cost>
</XMLAccessorial>
-<XMLAccessorial>
<Id>HTA</Id>
<Description>Heavy Traffic Congestion Fee-Destination</Description>
<Cost>35.00</Cost>
</XMLAccessorial>
</ExtraServiceBreakdown>
</XMLRateQuote>




I'm looping through the <XMLAccessorial> node. [Dim access As XmlElement = DirectCast(xmldoc.SelectSingleNode("/df:XMLRateQuote/df:ExtraServiceBreakdown/df:XMLAccessorial", mgr), XmlElement)] When I fire off the access.nextsibling all I get is the same ID, Description, and cost. (ISP,Inside Pickup,124.45) . Next sibling would be (HTA, Heavy Traffic COnjestion Fee destination, 35.00)




Dim access As XmlElement = DirectCast(xmldoc.SelectSingleNode("/df:XMLRateQuote/df:ExtraServiceBreakdown/df:XMLAccessorial", mgr), XmlElement)

Dim AccessorialID As XmlElement
Dim AccessorialDescription As XmlElement
Dim AccessorialCost As XmlElement
Dim strAccessorialID As String
Dim strAccessorialCost As String
Dim strAccessorialDescription As String

Do While (access IsNot Nothing)

If access.LocalName = "XMLAccessorial" Then
AccessorialID = DirectCast(xmldoc.SelectSingleNode("/df:XMLRateQuote/df:ExtraServiceBreakdown/df:XMLAccessorial/df:Id", mgr), XmlElement)
strAccessorialID = AccessorialID.InnerText.ToString
AccessorialDescription = DirectCast(xmldoc.SelectSingleNode("/df:XMLRateQuote/df:ExtraServiceBreakdown/df:XMLAccessorial/df:Description", mgr), XmlElement)
strAccessorialDescription = AccessorialDescription.InnerText.ToString
AccessorialCost = DirectCast(xmldoc.SelectSingleNode("/df:XMLRateQuote/df:ExtraServiceBreakdown/df:XMLAccessorial/df:Cost", mgr), XmlElement)
strAccessorialCost = AccessorialCost.InnerText.ToString
End If

access = access.NextSibling

Loop





RE: nextsibling grief

(OP)
Reposted to VB.net forum

RE: nextsibling grief

(OP)
Finally got it working. Posting incase someone else needs it



Dim doc As XmlDocument = New XmlDocument()
doc.Load("C:\Users\Dashley\documents\visual studio 2012\Projects\FreightRater\FreightRater\VITRtest.xml")
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)
nsmgr.AddNamespace("df", doc.DocumentElement.NamespaceURI)

Dim nodeList As XmlNodeList
Dim root As XmlElement = doc.DocumentElement
nodeList = root.SelectNodes("df:ExtraServiceBreakdown/df:XMLAccessorial", nsmgr)

Dim m_node As XmlNode
Dim description As String
Dim Id As String = Nothing
Dim Cost As String = Nothing

For Each m_node In nodeList
Id = m_node.Item("Id").InnerText
description = m_node.Item("Description").InnerText
Cost = m_node.Item("Cost").InnerText

Response.Write(Id & ", " & description & ", " & Cost & "<BR />")
Next

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