0

I'm using Jsoup and need to know text point of Element or Node in jsoup. Example: I have html: <p><span>1</span></p> then I need to know text point of <p> is 0,<span> is 4,</span> is 10... How to do that?

abc123
  • 11
  • 4

1 Answers1

0

Currently you can't do this in Jsoup, for it does not keep track of the positions of tags in the original input. There was some discussion going on about this earlier (JSOUP HTML Parser)

The solution is to use another parser that explicitly supports this feature. The other post suggested Jericho.

Community
  • 1
  • 1
luksch
  • 11,497
  • 6
  • 38
  • 53
  • jericho don't support unicode, I try read text file has à and the text return by jericho is Ã(while it's Ã). – abc123 Sep 10 '15 at 15:01