Sent this to dom4j-user, but maybe this list will have more input (I'm
pretty sure it's a bug in SAXContentHandler).
Thanks,
Jason
> There seems to be something fishy with the entity handling in dom4j1.2
> with newest Xerces-2.0.0. You can test with Java code below, and the XML
> files attached (run 'java test.Broked test.xml'). Here's the output I get
> (it's returning the entity!?)
> unixPrompt> java test.Broked test.xml
> Found node: &LmInclude; there
> Found node: hello world
>
> Where here's what I would expect:
> unixPrompt> java test.Broked test.xml
> Found node: hi there
> Found node: hello world
>
> Files below... I found if I comment out the 'startEntity'/'endEntity'
> code in SAXContentHandler it works as I'd expect.
>
> Thanks!
> Jason
>
> test.xml
> ---- cut here ----
> <?xml version="1.0"?>
> <!DOCTYPE broked [
> <!ELEMENT junk (#PCDATA)>
> <!ELEMENT broked (junk*)>
> <!ENTITY LmInclude SYSTEM "junk.xml">
> ]>
> <broked>
> &LmInclude;
> </broked>
> ---- cut here ----
>
> junk.xml
> ---- cut here ----
> <junk>hi there</junk><junk>hello world</junk>
> ---- cut here ----
>
>
> Here's the Java code Broked.java:
>
> package test;
>
> import java.util.*;
> import java.io.*;
> import org.xml.sax.*;
> import org.dom4j.*;
> import org.dom4j.io.SAXReader;
> import org.apache.log4j.*;
>
> /**
> * Insert the type's description here.
> * Creation date: (02/25/2002 5:13:25 PM)
> * @author: Jason Robertson
> */
> public class Broked {
> /**
> * Broked constructor comment.
> */
> public Broked() {
> super();
> }
> /**
> * Insert the method's description here.
> * Creation date: (02/25/2002 5:13:54 PM)
> * @param args java.lang.String[]
> */
> public static void main(String[] args) throws Exception {
> SAXReader reader = new SAXReader();
> reader.setValidation(true);
> Document doc = reader.read(args[0]);
> List l = doc.selectNodes("//broked/junk");
> for (int i = 0; i < l.size(); i++) {
> System.out.println("Found node: " +
> ((Element)l.get(i)).getStringValue());
> }
> }
> }
>
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev