Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 3rd, 2011, 12:23 AM
Registered User
 
Join Date: Jan 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default How To Do Relative xPath In CustomXMLNode?

howdy

this code, which loads a KML file, is working great. I'm getting the coordinates of the current oCustomNode in Excel VBA:

Code:
Sub Add_Traverse_CustomXMLPart()
    Dim oCustomPart As CustomXMLPart
    Dim oCustomNode As CustomXMLNode
    Dim oCustomNodes As CustomXMLNodes
    
    'Add a Custom XML Part from a file and then load
    Set oCustomPart = ActiveWorkbook.CustomXMLParts.Add
    oCustomPart.Load "C:\Documents and Settings\john\My Documents\Mapping\kml2static\Faith.kml"
    
    'Get Placemarks
    Set oCustomNodes = oCustomPart.SelectNodes("/ns0:kml[1]/ns0:Document[1]/ns0:Placemark")
    For Each oCustomNode In oCustomNodes
        MsgBox (oCustomNode.ChildNodes(8).ChildNodes(2).Text)
    Next
    ....
but, would prefer to use relative xPaths, instead of index numbers.

how?

this does not work:
Debug.Print oCustomNode.ChildNodes("Point/coordinates").Text

Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Relative URLs member4953 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 May 15th, 2009 04:40 PM
relative XPath references chroniclemaster1 XSLT 6 September 27th, 2007 01:16 AM
relative size query noam Access 4 December 12th, 2005 06:00 PM
Position: relative; czambran BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 April 7th, 2005 11:22 AM
Relative URLs? groupmatch BOOK: ASP.NET Website Programming Problem-Design-Solution 21 December 16th, 2004 10:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.