Closed Thread
Results 1 to 14 of 14

How To Do Relative xPath In CustomXMLNode?

  1. #1
    Registered User
    Join Date
    12-10-2010
    Location
    California
    MS-Off Ver
    Excel all versions from 5.0 (1993) to 365
    Posts
    38

    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:
    Please Login or Register  to view this content.
    but, would prefer to use relative xPaths, instead of index numbers.

    how?

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

    Thanks.
    Last edited by johnywhy; 01-03-2011 at 12:22 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How To Do Relative xPath In CustomXMLNode?

    Hello johnywhy,

    Our Forum Rules ask that you please list links to all sites where you have posted the same question. This keeps everyone who is helping you informed about solutions that have been proposed, rejected, and accepted.

    As a new member, please take some time to familiarize yourself with the rules.
    Forum Rules

    Cross posted at: http://www.mrexcel.com/forum/showthread.php?t=518569
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    12-10-2010
    Location
    California
    MS-Off Ver
    Excel all versions from 5.0 (1993) to 365
    Posts
    38

    Re: How To Do Relative xPath In CustomXMLNode?

    I'm posting this question with same username at other excel fora:

    Mrexcel.com
    Vbaexpress.com
    Ozgrid.com

    And probably will post on others. Hope you don't mind if I don't keep coming back to report to you where else I post the question, I might forget. I appreciate the help.

  4. #4
    Registered User
    Join Date
    12-10-2010
    Location
    California
    MS-Off Ver
    Excel all versions from 5.0 (1993) to 365
    Posts
    38

    Re: How To Do Relative xPath In CustomXMLNode?

    um... is it better if i not post this question many places?

  5. #5
    Registered User
    Join Date
    12-10-2010
    Location
    California
    MS-Off Ver
    Excel all versions from 5.0 (1993) to 365
    Posts
    38

    Re: How To Do Relative xPath In CustomXMLNode?

    resolved.... I got around this by using the DOM method, instead of CustomXMLPart's.

    CustomXMLPart's need namespace and other xPath weirdness that i don't get, and CustomXMLPart's appear to be tangled up in the Excel workbook structure. The DOM method does not involve Excel at all, so this can be ported to .NET.
    Please Login or Register  to view this content.
    This allows me to use simple xPath expressions as above. I can use oNode.SelectNodes to get child nodes relative to oNode using xPath...
    Please Login or Register  to view this content.
    CustomXMLPart's also have a SelectNodes method on the CustomXMLNode object, which is the answer to my original question. But i prefer the DOM method for reasons mentioned above.

    Requires reference to MSXML (Microsoft XML). sKmlUrl can be a local filepath or a url.
    Last edited by johnywhy; 01-04-2011 at 12:26 AM.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How To Do Relative xPath In CustomXMLNode?

    Hello johnywhy,

    Generally, it is better to post your question at a single site. But if you need an answer faster to complicated question then posting in several places makes sense. Thanks for posting the answer.

  7. #7
    Registered User
    Join Date
    12-10-2010
    Location
    California
    MS-Off Ver
    Excel all versions from 5.0 (1993) to 365
    Posts
    38

    Re: How To Do Relative xPath In CustomXMLNode?

    Generally, i disagree. I appreciate the service you provide. But I've never seen any other forum which requires me to report to you what other websites I post my question to.

    My activity on other websites, which are not related to your website, and which may have an entirely different readership than your website, is my own business.

    It's fine to ask people to not post the same question in multiple places on your site, aka "cross-posting". But if I post the same question on other websites, that is not cross-posting.
    Last edited by johnywhy; 01-03-2011 at 09:09 PM.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How To Do Relative xPath In CustomXMLNode?

    Hello johnywhy,

    You certainly have presented a convincing counterpoint to the standing policy. As a moderator, changes to policy lie outside my purview.

    Periodically policies are reviewed. During our next session, I will present your post for discussion and consideration to those who make the board policies.

  9. #9
    Registered User
    Join Date
    12-10-2010
    Location
    California
    MS-Off Ver
    Excel all versions from 5.0 (1993) to 365
    Posts
    38

    Re: How To Do Relative xPath In CustomXMLNode?

    thanks again, Leith

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How To Do Relative xPath In CustomXMLNode?

    My activity on other websites, which are not related to your website ... is my own business.

    But if I post the same question on other websites, that is not cross-posting.
    That will get you banned here if you continue to do so without posting links. That is our policy; you need not agree, but you may wish to be aware.
    Entia non sunt multiplicanda sine necessitate

  11. #11
    Registered User
    Join Date
    12-10-2010
    Location
    California
    MS-Off Ver
    Excel all versions from 5.0 (1993) to 365
    Posts
    38

    Re: How To Do Relative xPath In CustomXMLNode?

    no need, i'm canceling my account. but, for you to ban someone for what they post on other websites, or to require people to provide links to their posts on other websites, is retarded. you do not own the internet. and i DID list other sites where i posted the question.
    Last edited by johnywhy; 01-04-2011 at 01:29 AM.

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How To Do Relative xPath In CustomXMLNode?

    No one wants to spend time working on problems solved elsewhere.

    Happy to have you here, happy to see you leave if you prefer.

    Bye.

  13. #13
    Registered User
    Join Date
    12-10-2010
    Location
    California
    MS-Off Ver
    Excel all versions from 5.0 (1993) to 365
    Posts
    38

    Re: How To Do Relative xPath In CustomXMLNode?

    i answered my own question anyway.

    i'm pretty sure the internet is big enough that someone will benefit from answers posted in multiple places. the more places posted, the more readers it can benefit. no one website serves the entire planet earth.

    please cancel my account. readers will have to look elsewhere to find my solution.

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How To Do Relative xPath In CustomXMLNode?

    Okay, best of luck, bye.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1