Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. XPath Predicates

XPath Predicates

Scheduled Pinned Locked Moved XML / XSL
xmltutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    threemp3
    wrote on last edited by
    #1

    Hi guys Is it possible in xpath to select all elements that start with a value? For example, say I have this XML:- Nokia N73 Nokia N95 And I want to select all device elements whose name starts with "Nokia". Is there something like this in XPath: "/devices/device[name like 'Nokia*']" Thanks in advance

    T 1 Reply Last reply
    0
    • T threemp3

      Hi guys Is it possible in xpath to select all elements that start with a value? For example, say I have this XML:- Nokia N73 Nokia N95 And I want to select all device elements whose name starts with "Nokia". Is there something like this in XPath: "/devices/device[name like 'Nokia*']" Thanks in advance

      T Offline
      T Offline
      threemp3
      wrote on last edited by
      #2

      Sorry, the XML didn't show properly. See below for example XML:

      <devices>
      <device>
      <name>Nokia N73</name>
      </device>
      <device>
      <name>Nokia N95</name>
      </device>
      </devices>

      T 1 Reply Last reply
      0
      • T threemp3

        Sorry, the XML didn't show properly. See below for example XML:

        <devices>
        <device>
        <name>Nokia N73</name>
        </device>
        <device>
        <name>Nokia N95</name>
        </device>
        </devices>

        T Offline
        T Offline
        threemp3
        wrote on last edited by
        #3

        Don't worry guys, I've found the solution:- XPath: "/devices/device[starts-with(., 'Nokia')]"

        L 1 Reply Last reply
        0
        • T threemp3

          Don't worry guys, I've found the solution:- XPath: "/devices/device[starts-with(., 'Nokia')]"

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          threemp3 wrote:

          Don't worry guys, I've found the solution:-

          whew! What a relief!

          led mike

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups