Ents - Character entity/reference replacement




Ents - Character entity/reference replacement

Introduction | Warnings | Future Directions | License | Acknowledgments | Download

Ents is a small Java package designed to simplify the process of converting XML entity references to character references and vice-versa .

Introduction - Why Ents?

While XML 1.0 entities are useful, the move away from DTDs (as well as difficulties in processing them with non-validating parsers has made them less reliable.)

By running Ents over a file, all the character entities may be converted to character references or vice-versa. Ents only processes entities it has rules for, leaving the rest untouched.

Ents uses an XML format to specify lists of equivalent entity names and character references. Ents may only be used for single character entities. A file supporting XHTML 1.1 (and HTML) character entities is included, as is support for compiling that information into a class file.

The name comes from an abbreviation of entities, as Ents provides reduced functionality from XML 1.0's full set of entity capabilities. The Tolkien connection is pretty intriguing too, however.


Ents is thoroughly experimental and perhaps not even a good idea. Currently it operates on raw XML (and HTML) documents, and its FilterReader implementation has no notion of an XML Infoset.

Future directions

Ents is just getting started. I may expand Ents to permit one-way replacement of general entity references with longer strings of text. There's also an XMLFilter in progress (EntSAXFilter) which will permit the use of the same rules files with SAX2's skippedEntity event.


The contents of this package are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Original Code is available at http://simonstl.com/projects/fragment/original.

The Initial Developer of the Original Code is Simon St.Laurent. Portions created by Simon St.Laurent are Copyright (C) 2001 Simon St.Laurent. All Rights Reserved.



Thanks to the xml-dev mailing list for its continuing discussions of all these issues.


A download is available.

Introduction | Warnings | Future Directions | License | Acknowledgments | Download