XML support in Java 5?

P

Peter Duniho

It is worth noting that distributing with Xerces would not break WORA.

Sure. But it _would_ break my other goal of not having to distribute
additional components with my application.
Xeres is pure Java.

If it is an applet, then the size of the Xerces jar could be a problem,
but for desktop and server apps it is not a problem.

It's an application, but a small, relatively simple one. Its JAR is only
400K, and it's only that big because it's got a poorly-compressed AIFF
audio clip in it (accounting for the lion's share of that size). I don't
know how large the Xerces (or similar) download would be, but I suspect it
could equal or exceed the total size of my application (and that even
assumes that I don't eventually figure out how to get the audio clip to be
an MP3 instead...if I can get the audio clip's size down to something
reasonable for its length, the disparity would be that much larger).

I'm also not interested in introducing installation complexities, such as
those that might be required as part of delivering a third-party component
with the application.
And it is not just me thinking so.

I just checked my harddrive. I have 68 copies of Xerces. Because
so many apps come with it.

BEA, Borland, SUN, JBoss, IBM, Apache, Oracle.

Well, I have to say: just because everyone else is doing it, that doesn't
mean it's a good idea. Also, what's reasonable to include with an
application depends a lot on how large that application is.

Maybe if my application were larger, and maybe if I needed some specific
XML implementation behavior that that particular package provides, it
would be something I'd consider.

However, I've got a much better solution (and this is thanks to you, for
what it's worth :) ). The only problem with the solutions offered here
was that the built-in XML implementation wasn't handling indentation
properly, and the XSLT-based work-around I found on that previous link
addresses that nicely (the single-character linefeed in the XSLT even gets
converted to the CR/LF pair when running on the Windows Java
implementation), without introducing any implementation-specific
dependencies.

So now I've got my application working just fine (well, with respect to
the XML :) ), with a minimal amount of code, and without any dependency
other than the original Java 5 requirement.

Pete
 
G

Greg R. Broderick

Sure. But it _would_ break my other goal of not having to distribute
additional components with my application.

Xerces is distributed as part of the JRE 1.5, so you don't need to distribute
any additional components.



--
---------------------------------------------------------------------
Greg R. Broderick (e-mail address removed)

A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------
 
P

Peter Duniho

Xerces is distributed as part of the JRE 1.5, so you don't need to
distribute
any additional components.

I'm afraid I don't have the time to research this myself, and
unfortunately I'm getting mixed signals here. Arne's reply implies that
while Xerces is "by far the most widely used JAXP implementation", that
does not mean that all Java implementations use it. Arne's suggestion
that he's got 68 versions of it on his hard disk implies to me that it's
not part of the implementation (why would people deliver it as an add-on
if it were?).

On the other hand, you say (or at least imply) that _all_ 1.5
implementations will have Xerces. Is this fact documented somewhere
official? Or is it just something that's "common knowledge"?

In any case, I appear to have a solution that isn't dependent on the
implementation (which frankly, I feel should always be a goal in Java
development -- even though the environment has strengths other than that,
certainly it's my feeling that's one of the greatest ones). So it's
somewhat of a moot point. But if you have some official source that
clearly documents whether a specific implementation can be assumed, I'm
all ears.

Thanks!
Pete
 
L

Lew

Peter said:
I'm afraid I don't have the time to research this myself, and
unfortunately I'm getting mixed signals here. Arne's reply implies that
while Xerces is "by far the most widely used JAXP implementation", that
does not mean that all Java implementations use it. Arne's suggestion
that he's got 68 versions of it on his hard disk implies to me that it's
not part of the implementation (why would people deliver it as an add-on
if it were?).

On the other hand, you say (or at least imply) that _all_ 1.5
implementations will have Xerces. Is this fact documented somewhere
official? Or is it just something that's "common knowledge"?

In any case, I appear to have a solution that isn't dependent on the
implementation (which frankly, I feel should always be a goal in Java
development -- even though the environment has strengths other than
that, certainly it's my feeling that's one of the greatest ones). So
it's somewhat of a moot point. But if you have some official source
that clearly documents whether a specific implementation can be assumed,
I'm all ears.

Peter, the fact that the classes are documented as part of the API (e.g., the
org.xml.sax package) *is* the guarantee that they're part of the language.
You may relax.
 
P

Peter Duniho

Peter, the fact that the classes are documented as part of the API
(e.g., the org.xml.sax package) *is* the guarantee that they're part of
the language. You may relax.

Well, I don't see it as being that cut-and-dried. I'm not using a
specific class. I'm using an interface. The fact that the interface is
in the API only means that if someone implements the interface, it will
conform to the API. It doesn't actually guarantee someone has actually
implemented the interface.

Furthermore, in the context of this thread, the other thing that came up
was a suggestion (not a bad one, mind you) of how to configure the XML
output to use a specific indent for formatting. The property being set to
control the specific indentation was not one documented in the API; it was
specific to a certain implementation of the interface being used.

I am relaxing, because I have found what appears to be a reliable,
portable solution to the questions I've posed. But only because I've been
assured by Arne that even though I'm using a factory to get an
implementation of an interface, all 1.5 implementations will include
_some_ implementation of this interface. Without that assurance, there is
absolutely no reason to assume that just because the API documents an
interface all implementations of the API include an implementation of the
interface.

Pete
 
J

John W. Kennedy

Peter said:
That's an excellent question.

The answer is: because Apple can't be bothered to provide a Java 6
implementation for their operating system. Even for OS X 10.5
(Leopard), at best they've got a beta download of Java 6, and there's no
indication at all that Java 6 will ever be supported on OS X 10.4
(Tiger) or earlier.

You are right...a full year after the release of Java 6, you'd _think_
that you could rely on it being ubiquitous. But if you did, you'd be
wrong. :(

If I seem a bit bitter about this, well...it's because I am. :)

Huh? My wife's Powerbook got (via System Update) Java 6 a couple of
weeks ago when she was still running Tiger (she's on Leopard now).
 
A

Arne Vajhøj

Greg said:
Xerces is distributed as part of the JRE 1.5, so you don't need to distribute
any additional components.

SUN uses Xerces as their JAXP implementation. It is neither guaranteed
to be so in future SUN versions or in non-SUN versions.

Arne
 
A

Arne Vajhøj

Lew said:
Peter, the fact that the classes are documented as part of the API
(e.g., the org.xml.sax package) *is* the guarantee that they're part of
the language. You may relax.

java.xml, javax.xml, org.w3c.dom and org.xml.sax is guaranteed to
be there.

They are part of the JAXP interface.

But the Xerces implementation are not guaranteed to be there.

(the classes in org.apache.xml in the real Xerces and
com.sun.org.apache.xml.internal in SUN Java)

Arne
 
L

Lew

John said:
Huh? My wife's Powerbook got (via System Update) Java 6 a couple of
weeks ago when she was still running Tiger (she's on Leopard now).

Mac OS X includes the full version of J2SE 1.5, pre-installed with the
Java Development Kit (JDK) and the HotSpot virtual machine (VM), so you
don't have to download, install, or configure anything. ....
Apple has recently released a new developer preview of Java SE 6 for Leopard
via the Apple Developer Connection (ADC) site

What does "java -version" say on that Powerbook?
 
P

Peter Duniho

Huh? My wife's Powerbook got (via System Update) Java 6 a couple of
weeks ago when she was still running Tiger (she's on Leopard now).

As Daniele points out, what your wife got (I got it too) was what _Apple_
calls "Java 6". But it's not the 1.6 version of the JRE. It's Apple's
sixth version of the 1.5 JRE.

I leave it to the reader to assess what Apple's motivation might have been
in using a phrase associated with the actual latest version of Java in
describing their far-obsolete own implementation of Java.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top