Sibling Operators
WQL provides the following set of operators to refer to siblings of a specified element. The examples shown in these descriptions refer to the following HTML structure:
The sibling operators are constrained by the current parent. If an operator exceeds the boundaries of the current parent, a null value is produced for that reference.
doc.element[x].@n.property
References the nth sibling after element[x], regardless of type. Compare with doc.element[x].+n.property, below.
Example | Result |
doc.td[0].b[0].@1.text | Italic 0 |
doc.td[0].i[0].@1.text | Bold 1 |
doc.td[0].b[0].@4.text | Null |
doc.element[x].@-n.property
References the nth sibling prior to element[x], regardless of type. Compare with doc.element[x].-n.property, below.
Example | Result |
doc.td[1].b[end].@-2.text | Bold 3 |
doc.td[1].i[end].@-1.text | Bold 4 |
doc.td[1].b[end].@-3.text | Null |
doc.element[x].+n.property
References the nth sibling after element[x] that is of the same type as element[x]. Compare with doc.element[x].@n.property, above.
Example | Result |
doc.td[0].b[0].+1.text | Bold 1 |
doc.td[0].i[0].+1.text | Null |
doc.td[0].b[0].+3.text | Null |
doc.element[x].-n.property
References the nth sibling before element[x] that is of the same type as element[x]. Compare with doc.element[x].@-n.property, above.
Example | Result |
doc.td[1].b[end].-2.text | Null |
doc.td[1].i[end].-1.text | Italic 1 |
doc.td[1].b[end].-3.text | Null |