Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM 1.0 alpha 1 is here

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Michael Abato <mrabato AT earthlink.net>
  • To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Cc:
  • Subject: Re: [XOM-interest] XOM 1.0 alpha 1 is here
  • Date: Thu, 10 Jun 2004 10:15:27 -0400
  • Resent-date: Thu, 10 Jun 2004 10:16:00 -0400
  • Resent-from: Michael Abato <mrabato AT earthlink.net>
  • Resent-to: xom-interest AT lists.ibiblio.org

I understand, sympathize with, and support not being comfortable with not checking. But I'm also not comfortable with not "playing nice" in a shared environment. Looking closer at the code, it becomes obvious that it is not airtight, as this "fix" will get "unfixed" by any piece of code, anywhere, that does a System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration" , ...).

A simple, though still kinda smelly, workaround is to take advantage of this flaw and do something like:

static {
if ( new Builder() != null ) { // force static init
System.setProperty(
"org.apache.xerces.xni.parser.XMLParserConfiguration",
"org.apache.xerces.parsers.XML11Configuration");
}
}

which resets org.apache.xerces.xni.parser.XMLParserConfiguration" to its original value, which is globally safe.

In addition to not liking the arms race with XOM's implementation details, this solution is technically not "thread safe". Should a thread in another process attempt to create a Xerces parser between the static init of XOM and the resetting of the property, it would throw the ClassNotFoundException. This is obviously obscure and limited to deploy-time, however.

Michael Abato

On Jun 9, 2004, at 8:25 AM, Elliotte Rusty Harold wrote:

At 3:25 PM -0400 6/8/04, Michael Abato wrote:

I would favor looking for system property "javax.servlet.context.tempdir" (which implies you are in a servlet container) and respecting a user-set system property like "nu.xom.no-verify-XML1_0". Other known containers could be added as "signals" are identified. Does anyone know a good EJB signal?

The problem is XOM needs to do this. Not performing verification is not an option I'm comfortable with. The code assumes the parser has verified XML 1.0 well-formedness, and the only way to make current versions of Xerces do this is to set that system property to point to my own parser configuration. I filed the bug report you referenced to try to let me do this just for XOM's parser without stepping all over everyone else's parsers, but so far I can't see how to do that.

--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/ cafeaulaitA






Archive powered by MHonArc 2.6.24.

Top of Page