简体   繁体   中英

How to filter a StAX XMLStreamReader

I need to hook into an API that receives a StAX XMLStreamReader as the input, and filter the supplied stream (change the value of a certain attribute from true to false).

Looked at StreamReaderDelegate , but with that one I'd have to do a lot of coding to keep track of all access paths to the attribute in question.

Is there a better way?

Thanks in advance!

With StAX, you could use the event API instead and utilize the EventReaderDelegate . The amount of code would be roughly the same though. Using delegates is also the recommended solution, so I'm afraid, there is no significantly better way.

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