java - Highlight nodes covered by XPath -


i want highlight nodes covered given xpath in html page source.

i looked in htmlunit, not find thing in api.

at present, thinking of doing following way:

  1. get xpath , page-source.
  2. break xpath smaller chunks , store them in xpath_chunk[].
  3. apply chunk xpath_chunk[] starting 0.
  4. update css property of each node found each chunk(any change distinguishes text).
  5. now add next chunk , concate current.
  6. go step 3.

in way, visit nodes covered xpath. more changes can remove elements unnecessarily highlighted.

this complicated. there way ?

i made rudimentary implementation using javafx's webengine + webview. register dom listener nodes of loaded website's document, can listen clicks on nodes. when clicking, change style of node , add css. webview reflect changes , render page correctly.

the document webengine returns can accessed using xpath (it's w3d document), can traverse , modify nodes encounter (or use node furthest down, travel upwards using getparent(), , modify each parent well).


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -