Can xpath select from one element to a different type of element? -
New camera for xpath, so perhaps it does not know the vocabulary to properly search.
I want to take the end of a paragraph with a specific ID from the beginning of a div with a specific ID. Note that I only want to select the part of the div. The more general viewpoint, you are the lower-siblings and the ex-siblings You can try to select a range of elements by ID attributes. All children above the example show a selection of elements & lt; body & gt; & Lt; Div id = "meaninglessPreamble" & gt; Do not get this data. & Lt; / Div & gt; & Lt; Div id = "wrapper" & gt; & Lt; Div id = "grab this" & gt; Good things & lt; / Div & gt; & Lt; P id = "grab thisToo" & gt; Better things & lt; / P & gt; & Lt; P id = "endHere" /> & Lt; P id = "leaveMeOutOfThis" & gt; Unwanted junk & lt; / P & gt; & Lt; / Div & gt; & Lt; / Body & gt;
/ body / div [@ id = 'wrapper'] / * [(predecessor-sibling :: * [@ id = 'grab this'] or @ id = 'grab' ) And (following-sibling :: * [[id = 'end here'] or @ id = 'end here')]
& lt; Div id = "wrapper" & gt; Include the element with the
id = "endHere" with the element ,
id = "grab this" . If you want to select it specifically (exclude limited elements), just remove the
or @id = '...' section.
Comments
Post a Comment