pyjab icon indicating copy to clipboard operation
pyjab copied to clipboard

Xpath Parser enhancement

Open gaozhao1989 opened this issue 2 years ago • 2 comments

Xpath Parser enhancement. Set Xpath Parser almost like this Xpath

  1. Nodes

    • [x] nodename : select specific nodename
    • [ ] / : select from root node(get child node)
    • [ ] // : select any matched node ignore current node position(get child node)
    • [ ] . : select current node
    • [ ] .. : select parent node
    • [x] @ : select node attribute
  2. Predicates

    • [x] /foo/bar[1] : select the first element 'bar' from element 'foo'
    • [ ] /foo[@name = 'bar']: select all 'foo' elements that attribute "name" attribute with a value of "bar"
    • [ ] /foo[@indexinparent > 10]: select all 'foo' elements which attribute "indexinparent" large than 10
  3. Unkown Nodes

    • [x] //* : match any element node
  4. Several Paths

    • [ ] //foo/bar | //foo/baz : select all the 'bar' and 'baz' elements of all 'foo' elements
    • [ ] //foo | //bar : select all the 'foo' and 'bar' elements in document
  5. Axes(In future)

  6. Operations

    • [ ] //foo | //bar : computes two node-sets
    • [ ] @name = 'foo' : name equals to string 'foo'(also need support for other attribute)
    • [ ] @role != 'foo' : role not equal to string 'foo'(also need support for other attribute)
    • [ ] @indexinparent < 2 : index in parent less than 2(also need support for objectdepth)
    • [ ] @indexinparent <= 2 : index in parent less than or equal to 2(also need support for objectdepth)
    • [ ] @indexinparent > 2 : index in parent greater than 2(also need support for objectdepth)
    • [ ] @indexinparent >= 2 : index in parent greater than or equal to 2(also need support for objectdepth)
    • [ ] @name = 'foo' or @name = 'bar' name equals to string 'foo' or 'bar'
    • [ ] @name = 'foo' and @role = 'bar' name equals to string 'foo' and role equals to string 'bar'

gaozhao1989 avatar Jul 13 '22 15:07 gaozhao1989