How can i find the text node that directly preceeds the "specialElem"-element ("Foo-" in this example)? While all other whitespaces inside the "main"-element shall be preserved, the whitespaces in front of the "specialElem"-element shall be removed.
<main>
Foo Foo
<someElem>
Foo Foo
</someElem>
Foo Foo
<otherElem>
<subElem>
Foo Foo
</subElem>
</otherElem>
Foo- <!-- the whitespaces here shall be removed -->
<specialElem>
Bar!
<specialElem/>
Foo Foo
</main>
Desired output:
Foo Foo Foo Foo Foo Foo Foo Foo Foo-Bar! Foo Foo
Thnaks in advance!
No comments:
Post a Comment