[jdom-interest] StAX support
Rolf
jdom at tuis.net
Sun Nov 13 18:03:36 PST 2011
Hi All.
I have been trying to put StAX support in to JDOM for a little while
now, and I have just pushed through the code to github that contains the
majority of the anticipated API on the JDOM side for handling the StAX
parsing/processing of XML.
I have been using as references the StAX specification, the JDOM 'way'
of doing things, and the rest of the web.
Some observations I have:
1. StAX is currently the fastest way (slightly) to parse XML on my computer.
2. The StAX specification is perhaps the very worst specification I have
ever seen for functionality currently in the Java language/API. I hope
that other concepts in the JCP process have better results.
3. XML Validation with StAX is 'hard'.
4. DOCTYPE handling in StAX is unpredictable.
5. after having been around for almost as long as JDOM, the StAX concept
is still 'dynamic' and changing.
Essentially, I have had a long hard look at it, and I think there were a
number of oversights in the process.... it's a good concept that has had
a poor implementation.
On the other hand, I have put a fair amount of thought in to it, and
gone a long way to making it work well in JDOM (within the limitations
of StAX), and there may be some use in it.
My thinking is that I will leave the code in there for the moment, but
it is incomplete, and I really need to work on something else in the
meantime.
It is still a 50/50 as to whether it should be in there, or be stripped
out again.
What I would really like is to get in touch with a StAX 'expert' and run
some of my concerns past them.
Is there someone on this list with some StAX insight?
Is there a forum anyone knows of that's dedicated to the StAX
implementation in Java?
Anyway, I would appreciate it if some people with StAX experience played
with the code:
String filename = "myfile.xml";
StreamSource source = new StreamSource(new File(filename));
XMLInputFactory inputfac = XMLInputFactory.newInstance();
inputfac.setProperty(
"http://java.sun.com/xml/stream/properties/report-cdata-event",
Boolean.TRUE);
XMLStreamReader reader = inputfac.createXMLStreamReader(source);
StAXStreamBuilder stxb = new StAXStreamBuilder();
Document staxbuild = stxb.build(reader);
Rolf
More information about the jdom-interest
mailing list