Thread: relative paths with XPath in libxml2

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    Stockholm
    Posts
    2

    relative paths with XPath in libxml2

    Hi everyone!
    I'm using libxml2 in linux and want to learn how to do it with xpath instead of manually traversing the tree. However, to make it useful I need to use relative path instead of having to start from the root all the time as with

    Code:
    result = xmlXPathEvalExpression(path, context);
    This must be possible! Any input is wellcome!

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Try googling for "libxml2 xpath relative path" or something similar. Or maybe guess the name. xmlXPathRelativeEvalExpression . . . .
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Location
    Stockholm
    Posts
    2
    I tried that off course! And XPath contains NO functions with 'Relative' in it. So... that won't cut it

  4. #4
    Registered User SKeane's Avatar
    Join Date
    Sep 2006
    Location
    England
    Posts
    234
    I think you may have to maintain the relative path yourself and always pass the root to the function.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. exec with system(..), how to use relative paths?
    By sept in forum C++ Programming
    Replies: 2
    Last Post: 08-24-2008, 01:22 PM
  2. relative paths with autotools
    By zxcv in forum Tech Board
    Replies: 1
    Last Post: 02-28-2008, 11:18 AM
  3. boost::filesystem - relative paths
    By azteched in forum C++ Programming
    Replies: 2
    Last Post: 03-05-2005, 06:24 AM
  4. using relative file paths..?
    By anomaly in forum C++ Programming
    Replies: 2
    Last Post: 11-25-2003, 03:36 PM
  5. Newbie Question: File Input and Relative Paths
    By Ashes999 in forum C++ Programming
    Replies: 11
    Last Post: 05-23-2003, 04:21 AM