[jdom-interest] Probably a Stupid Question but...

Brad Morgan Brad.Morgan at e-pubcorp.com
Fri Oct 6 10:13:25 PDT 2000

When I execute my program from its .class files it works.

When I place all the .class files into a jar file, it fails when I try and
open the xml file (can't find SAXBuilder, see below).

Program starts and displays its main window, so I think the jar file is
build correctly (and I have other programs not using JDOM that work being
built this way).

What am I doing wrong?

(Windows NT 4.0, JDK 1.3, I'm developing using Forte for Java CE 1.0.2 but I
built everything for this test using just the JDK tools)



D:\DDD>java -classpath jdom.jar;xerces.jar;. JobTicTrack  <-- Works

D:\DDD>java -classpath jdom.jar;xerces.jar;. -jar JobTicTrack.jar  <-- Fails

Exception occurred during event dispatching:
java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder
        at JobTicTrack.OpenJobTicket(JobTicTrack.java:414)
        at JobTicTrack.access$100(JobTicTrack.java:18)
        at JobTicTrack$2.actionPerformed(JobTicTrack.java:92)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
        at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

Brad Morgan
e-Publishing Corp.

Email: Brad.Morgan at e-pubcorp.com
Phone: (719)593-7377 x35
Fax: (719)593-2996

e-Publishing Corp. is a BroadVision company
NOTICE: This message is intended only for the use of the Addressee and may
contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the
intended recipient, dissemination of this communication is prohibited. If
you have received this communication in error, please erase all copies of
the message and its attachments and notify us immediately.

-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of kendrick at us.ibm.com
Sent: Friday, October 06, 2000 8:50 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] XMLOutputter - Unwanted line breaks occurring
between tags

I am using XMLOutputter to output XML with line breaks, and it is working
reasonably well.  However, I have noticed that when an element whose
content is null is outputted, a line break occurs between the opening and
closing tags.  I would prefer that the opening and closing tags occur on
the same line as they do when the element's content is an empty string.

For example, the following code:
     root.addContent(new Element("name").setText(null));
produces the following output:

However the following code:
     root.addContent(new Element("name").setText(""));
produces the following output:

The line break appears to occur because the test for "stringOnly" in the
printElement() method of XMLOutputter results in false when the element's
content is null.  I recommend modifying the test for "stringOnly" to
include the check for a null value.  That seems to cause the output of an
element's tags to appear on the same line when the content is null.

protected void printElement(Element element, Writer out,
                    int indentLevel, NamespaceStack namespaces)  throws
IOException {
     List mixedContent = element.getMixedContent();
     boolean empty = mixedContent.size() == 0;
     boolean stringOnly =
          !empty &&
          mixedContent.size() == 1 &&
          (mixedContent.get(0) instanceof String || mixedContent.get(0) ==

Shannon Kendrick

IBM e-business Integration Services - Atlanta, GA

To control your jdom-interest membership:

More information about the jdom-interest mailing list