Chip,

You can solve your problem in some ways:
- use dom4j 1.5 RC1: in this release, your apostrophes won't be converterd to "'" anymore (they won't be converted to anything)
or
- read the JAXP release notes where solutions are described to change this entity expansion limit: http://java.sun.com/webservices/docs/1.2/jaxp/ReleaseNotes.html*


*regards,
Maarten

Chip Whitmer wrote:

Hi -- I'm new here. :-)
I am working with some large XML files (~6MB) that serve as indexes into hundreds of smaller XML content files. The large index files include element attributes whose value is an XPath string, something like this:
<page xpath="/sm/[EMAIL PROTECTED]&apos;09_02_0045&apos;]"/>
Each index file contains thousands of these elements. As the indexes have grown larger, I have started seeing the following exception:
org.dom4j.DocumentException: Error on line 31111 of document: Parser has reached the entity expansion limit "64,000" set by the Application. Nested exception: Parser has reached the entity expansion limit "64,000" set by the Application.
at org.dom4j.io.SAXReader.read(SAXReader.java:355)
at org.dom4j.io.SAXReader.read(SAXReader.java:297)
The problem seems to be all of those "&apos;" entities. (There are as many as 85,000 of them in some of the files.) But the apostrophes are required by the XPath syntax. So I have a few questions:
1) Why does this 64,000-entity limit exist?
2) The error message says the limit was "set by the Application." Does this mean there is a configurable limit that I can modify to avoid the exception?
3) The problem goes away if I manually replace all the entities ( &apos; ) with character references ( &#39; ). However, my code sets the dom4j attribute value using a plain apostrophe in a Java string:
pageElement.addAttribute( "xpath", "/sm/[EMAIL PROTECTED]'09_02_0045']" );
dom4j is apparently converting the apostrophes to entities as the document is written to disk. Is there a way to tell dom4j to write the data using character references, rather than entities?
Thanks,
- Chip Whitmer
Mobile Productivity, Inc.






-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to