dxml icon indicating copy to clipboard operation
dxml copied to clipboard

How to get position of end tag?

Open bubnenkoff opened this issue 6 years ago • 1 comments

I need to get position of end (closing tag). But I can't figure out how to do it. Could anybody give me an example or explain how to do it?

The situation. I am looking tag foo and want to cut out all content of it till the closing tag.

bubnenkoff avatar Mar 29 '19 14:03 bubnenkoff

Every Entity has a pos attribute which gives the TextPos for that element - though if SplitEmpty.yes is used, then the TextPos for the start and end tags will be the same, because they're actually the same tag. However, if what you want to do is just go from a start tag and jump to its corresponding end tag, popping off all of the entities in between from the range, then use skipContents: http://jmdavisprog.com/docs/dxml/0.4.0/dxml_parser.html#.skipContents

jmdavis avatar May 03 '19 08:05 jmdavis