Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] StAXBuilder.java

Tatu Saloranta

2004-06-17


Ok, I wrote a simple JDom document builder that can
create JDom documents from a StAX XMLStreamReader,
using the DOM-based builder as an example.
[for more information about StAX API for XML-parsing,
docs, implementations, you can go to:
https://stax-utils.dev.java.net/
]

To compile it, StAX API has to be available; I added
lines:

[line 77]
  <property name="stax.jar"
value="${lib.dir}/stax1.0.jar"/>

[line 86]
   <pathelement location="${stax.jar}"/>

to build.xml, and 'stax1.0.jar' into lib directory
locally.

From my limited testing it seemed to build a document
ok; I was able to do clean round-trip with simple
XML-docs (XML file -> StAX -> JDom -> serialize to
file).

Oh, and the code compiled with latest CVS source, but
not with b10; I guess there have been a few API
changes recently, to get them in for 1.0?

Let me know if it looks good. It'd also be interesting
to know how performance compares to SAX-based
alternatives (there shouldn't be huge differences but
who knows).

-+ Tatu +-



   
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

Attachment: StAXBuilder.java
©2008 junlu.com - Jax Systems, LLC, U.S.A.