[jdom-interest] Xalan exception on valid element names... and odd
.jar issues/questions
Mark Bennett
mbennett at ideaeng.com
Wed Dec 5 20:05:12 PST 2001
Thanks for the suggestion.
I did a search and did find multiple xalan.jar files. However, by
selectively renaming files and retrying I did confirm that I'm using the
xalan.jar that came with JDOM.
jdom/lib/xalan.jar 782k / 801,714 bytes 5/18/2001
But rereading the FAQ and doing some more experimenting I found some other
jar issues. The good news: I've got it working. The bad news: I'm more
confused now then I was before. :)
Things I found confusing (maybe of interest to others):
1: I t seemed that a bad version of xerces.jar was the culprit. Since I
believe this heavily used by JDOM which I've been using for a while, I would
have expected this to be a problem earlier.
2: Apparently adding a jar to the project path once actually has an affect
in two places, compile time and runtime. In hindsight this probably makes
sense, but not something I was conscious of.
3: Apparently JBuilder ships with an older version of Xerces, but it's only
found at runtime.
So, I got compile errors. Added the xerces I wanted to the path, and the
problems went away. "Ah, I have the right xerces" No! What I think was
happening was it was compiling with the new version, but running with the
older version in JBuilder ext. If this is true I think it's a poor design
in the IDE.
4: So I got rid of (renamed) all the xerces.jar files I could find to make
sure I had the right one. I even got a sharing violation when I tried to
rename one of them, so that helped confirm that this was in fact the file
the runtime was finding. But after exiting JBuilder and renaming ALL files,
and restarting JBuilder, my program still ran! I had expected it to fail,
then I would re-rename the correct file and then it would run.
So how can I parse XML with no xerces? Maybe it's part of jaxp...
I repeated the process of renaming with jaxp. I did see where it was using
one of them, via a sharing violation. But after exiting and renaming and
restarting JBuilder my program still ran, now with no jaxp either?
Odd I thought. I know it was using the jar file because of the sharing
violation, but now with that file removed it still runs.
I then un-jar'd the jdom.jar file itself. I see there are some SAX parsers
there as well. I assume those are the classes it's now finding.
Some questions I was wondering about:
* So jdom.jar includes copies of the .class files used by xerces?
* I thought I had got xerces.jar as part of the jdom distribution? Isn't
that redundant?
A bit of non-jdom specific pondering, if anybody is interested in
commenting:
A concern that I have is reproducing a working environment on a client's
machine. In addition to jdom we're using quite a bit of other .jar files
from other 3rd parties; all of which are redistributable. :) Reproducing
working environments between Windows and Linux has already proved a problem,
and we've added a lot of 3rd party items since then.
One of our developers has suggested not using .jar files AT ALL. That all
3rd party jar files be unjar'd to class files and put into our project's
class hierarchy. Then we'll create one giant jar file with all the class
files in then.
Another developer has just put all the jar files in one giant directory and
then created a really long path to include each named .jar file by name in
the path. On the one hand, in terms of packaging, this is easier to
understand. But the path'ing issue is a hassle. I'm also troubled in the
"what's in what" problem I was seeing above. It looks like some .class
files are in multiple jar files.
I had chimed in with another idea that maybe we should just catalog all the
.jar files and shove them in the JVM's "ext" directory during installation.
This worries me because of possible collisions with existing .jar files,
like I would have had with JBuilder. Maybe shipping a JRE would solve that,
but there are distribution issues with JRE's aren't there?
I was also a curious if there's a way to see the path names of the actual
.class files the JVM has loaded - what did it find?
Would appreciate any comments,
Mark
-----Original Message-----
From: tril at pluto.blackwell.co.uk [mailto:tril at pluto.blackwell.co.uk]On
Behalf Of Ian Lea
Sent: Wednesday, December 05, 2001 2:01 AM
To: mbennett at ideaeng.com
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] Xalan exception on valid element names, no
exception for invalid names
Looks like you might have some old jars lurking somewhere.
See the FAQ at http://www.jdom.org/docs/faq.html.
--
Ian.
ian.lea at blackwell.co.uk
Mark Bennett wrote:
>
> I'm pointed to the Xalan that came with JDom Beta 7. I now have simple
> "hello world" style sheets working.
>
> While walking a tree I'm getting exceptions from the value-of and for-each
> elements.
>
> Oddly, in value-of, I only get the exception with VALID element or
attribute
> names. If I make up a bogus name it doesn't complain (and I just don't
get
> any data).
>
> If I do:
> <xsl:value-of select="good_element_name" />
> <xsl:value-of select="@good_attribute_name" />
> I get the exception shown below.
>
> If I change it to:
> <xsl:value-of select="bogus_element_name" />
> <xsl:value-of select="@bogus_attribute_name" />
> I don't get an exception.
>
> I've also had trouble if I use "/" in the select attribute of for-each.
The
> exception is also shown below. The workaround here was to do a for each
one
> level at a time.
>
> Exception if using VALID element or attribute name:
> java.lang.NoSuchMethodError
> at
org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:269)
> at
>
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.ja
> va:495)
> at
org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:228)
> at
>
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.ja
> va:495)
> at
org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:228)
> at
>
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.ja
> va:495)
> at
org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:228)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2154)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2097)
> at
>
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:
> 739)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2154)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2097)
> at
>
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:
> 739)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2154)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2097)
> at
>
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Transformer
> Impl.java:2029)
> at
>
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
> ava:1189)
> at
>
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
> at java.lang.Thread.run(Thread.java:484)
>
> Exception I get using "/" in XPath of a for-each tag:
> java.lang.NoSuchMethodError
> at
>
org.apache.xpath.axes.ChildWalkerMultiStep.getNextNode(ChildWalkerMultiStep.
> java:95)
> at
>
org.apache.xpath.axes.ChildWalkerMultiStep.nextNode(ChildWalkerMultiStep.jav
> a:147)
> at
org.apache.xpath.axes.LocPathIterator.nextNode(LocPathIterator.java:689)
> at
>
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.ja
> va:428)
> at
org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:228)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2154)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2097)
> at
>
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:
> 739)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2154)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2097)
> at
>
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:
> 739)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2154)
> at
>
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
> erImpl.java:2097)
> at
>
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Transformer
> Impl.java:2029)
> at
>
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
> ava:1189)
> at
>
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
> at java.lang.Thread.run(Thread.java:484)
More information about the jdom-interest
mailing list