exificient
exificient copied to clipboard
Is Exificient compatible with the StAX iterator API (aka XMLEventReader/XMLEventWriter)?
Hi, I've been digging through the source for exificient today, trying to understand how to use it with my program that I wrote that uses the XMLEventWriter Class of StAX , which currently can write to standard text XML files, and I'm trying to figure out how to obtain an XMLEventWriter implementor object that writes to an underlying EXI file, but. . . I am having difficulty finding that.
It looks to me like exificient currently only implements the XMLStreamReader/XMLStreamWriter APIs?
Am I missing something like maybe exificient doesn't need to implement the Event APIs, because you can somehow request an XMLEventReader or Writer using the standard StAX implementation in the JDK, that is bound to an underlying exificient StreamReader/Writer. Something like XMLEventFactory.createXMLEventWriter(StAXEncoder); ??
Hi,
yes, the StAX API that is supported can be found under https://github.com/EXIficient/exificient/tree/master/src/main/java/com/siemens/ct/exi/main/api/stream
Hence, it implements XMLStreamReader and XMLStreamWriter.
As you can see in those 2 implementations you can also implement your own interface by calling the core
Note: A compliant EXI stream needs to have a header also.
I am not sure which interface support you are looking for. Are you looking for something like https://github.com/EXIficient/exificient/blob/master/src/test/java/com/siemens/ct/exi/main/TestStAXEncoder.java ?
I hope this helps,
-- Daniel
@danielpeintner
So, what you have mentioned above, XMLStreamReader and XMLStreamWriter interfaces, are only half of StAX. Those are what are also called the "Cursor API".
There is a second set of interfaces that are part of StAX, called the "Iterator API", as documented in this page:
https://docs.oracle.com/javase/tutorial/jaxp/stax/api.html
Those two interfaces, as I mentioned above, are "XMLEventReader" and "XMLEventWriter".
It would be nice if exificient could also implement those, so that ALL the Java standard XML APIs are covered by exificient.
On Sourceforge [1] I read that there is XMLEventStreamWriter (and most probably also the reader counterpart) which is an implementation of the XMLStreamWriter interface that wraps an XMLEventWriter. Hence, I assume it is possible to write/use such a mapping.
Anyhow, you are welcome to contribute the StAX iterator API for EXIficient 👍 Unfortunately, I will not have the time to do so.
[1] https://stackoverflow.com/questions/31112071/can-i-adapt-from-xmleventwriter-to-xmlstreamwriter