[jdom-interest] Incorrect output

Thomas M. Sasala tsasala at hifusion.com
Thu Jun 29 05:12:56 PDT 2000


> 
> I missed that. It does seem to be a real bug. Can we get the code and
> sample files that do this so we can take a look? Also useful to know
> would be what parser you're using. It's not necessarily a bug in
> XMLOutputter, though it could well be. There are a couple of other
> points in the system where info could be lost.
> 
> As to white space, I continue to maintain that keeping it should be
> the default behavior, and that throwing it away without an explicit
> request is non-intuitive and will confuse people. But we've  already
> been through this one.


	The problem has been fixed in CVS, but I've inclided the information 
you requested.  

	I'm still getting the class def error after downloading and
building the jar from CVS.  It can't find the NoSuchElementException.
The comes from the jar that Jason sent and the jar I built from
scratch.  Build environment is linux/redhat/2.2.14/jdk1.2.2-rc4.
The runtime environment is Solaris/2.7/jdk1.2.2-ref (both 
command line and from within Weblogic app server).


<my_doc>
  <hf_text>
    <a href="test"></a>
  </hf_text>
  <hf_text>
    <a href="test"></a>
    -- URL to the left
  </hf_text>
  <hf_text>
    URL to the right 
    <a href="test"></a>
  </hf_text>
  <hf_text>
    URL to the right
    <a href="test"></a>
    URL to the left
  </hf_text>
</my_doc>


	The java source file that generated the erroneous output
with the b4 build is:

import java.io.*;
import java.util.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;

import com.hifusion.xml.*;

public class jdom_test {

    public static void main(String[] arg) {

	if(arg.length < 1) {
	    System.out.println("usage: java jdom_test <filename>");
	    System.exit(0);
	}

	jdom_test t = new jdom_test(arg[0]);

    }

    public jdom_test(String filename) {

	try {

	    SAXBuilder b = new SAXBuilder();

	    System.out.println("Building DOM document...");

	    Document doc = b.build(new File(filename));

	    XMLOutputter fmt = new XMLOutputter();

	    //XMLUtils.merge(doc);
	    fmt.output(doc, System.out);
	    
	    //System.out.println("Building HTML...");

	    //Document d= XMLUtils.merge(doc);
	    System.out.println("The HTML is:\n"+Publisher.getHTML(doc));

	    //System.out.println("The raw doc is:
"+XMLUtils.Element2String(doc.getRootElement()));
	    //XMLOutputter fmt = new XMLOutputter();
	    //fmt.output(d, System.out);

	} catch(Exception ex) {

	    ex.printStackTrace();
	}
    }
}


	-Tom


> 
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |                  The XML Bible (IDG Books, 1999)                   |
> |              http://metalab.unc.edu/xml/books/bible/               |
> |   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
> |  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
> +----------------------------------+---------------------------------+



More information about the jdom-interest mailing list