简体   繁体   中英

StAX/StAX2 attributes' location in source XML

I need to get the offsets (start and end location) in source XML for each extracted text information.

I need to use the XML PULL READING model, so I've been experimenting with StAX and StAX2 (Woodstox) for some time.

Original StAX contains API:

javax.xml.stream.Location

However, this class is rather obscure. So here goes the StAX2 (Woodstox) which contains an improved API:

org.codehaus.stax2.LocationInfo

It works nicely for elements and stuff via the LocationInfo.

My problem: How can I get the offset of attributes since they are apparently a part of element? So the location's granuarity is on element level -> I can get offsets for entire element and not for each attribute...

Thanks in advance!

Woodstox不跟踪属性值的开始/结束偏移,仅跟踪元素。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM