0

I have got the following HTML:

some text <b>some bold text</b>
<span property='some property1>
some semantic term2</span> 
<p><span id='mark1'></span>
some text <i>some italic text</i></p>
<span property='some property2'>
some semantic term</span>
<span id='mark2'></span>

I would like to select all span elements with a 'property' attribute, which are placed between the span elements with ids 'mark1' and 'mark2' (these are my technical bookmarks, which should be then removed) and unwrap it.

I think the best way to implement it in Java Jsoup is to use the doc.select function. But I can't create the correct CSS query (I need something like: every span elements with property attribute BETWEEN these two elements).

The expected result (after removing the bookmarks):

  some text <b>some bold text</b>
    <span property='some property1>
    some semantic term2</span> 
    <p>
    some text <i>some italic text</i></p>
    some semantic term

Any ideas? Maybe something like E ~ F. Thanks a lot!

4

1 に答える 1