Hello, 

I use dom4j-1.6.1 to parse an XML file with use of entity references. It seems 
that the entity reference is not replaced by its value :

The file :

<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "hibernate-mapping-3.0.dtd" 
     [
<!ENTITY % errorMessage "&lt;id name=&quot;errorMessageNumber&quot; 
type=&quot;string&quot; column=&quot;NUMMSG&quot; &gt;
                &lt;generator class=&quot;assigned&quot; /&gt;
&lt;/id&gt;
&lt;property name=&quot;wordingOfMessage_1&quot; column=&quot;LIBMSG_1&quot; 
type=&quot;string&quot;  not-null=&quot;true&quot; /&gt; ">]>

<hibernate-mapping>

    <class name="ErrorMessage"> 
                %errorMessage;
    </class>
       
</hibernate-mapping>

I got the following error message :

org.xml.sax.SAXParseException: Element "class" does not allow text.
        at org.apache.crimson.parser.Parser2.error(Parser2.java:3354)
        at 
org.apache.crimson.parser.ValidatingParser$ChildrenValidator.text(ValidatingParser.java:355)
        at 
org.apache.crimson.parser.InputEntity.parsedContent(InputEntity.java:597)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:2010)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at org.dom4j.io.SAXReader.read(SAXReader.java:465)
        at org.dom4j.io.SAXReader.read(SAXReader.java:321)

Here is the code of the treatement : 

SAXReader xmlReader = new SAXReader(true);
document = xmlReader.read("ErrorMessage.hbm.xml");


Is anyone have any idea ?


        
___________________________________
 Jérémie Balcaen


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to