This has problems when converting XML to a string. How are these entities to be treated? How does the parser know when to escape the & or when to keep it. However this is a useful idea and one of the uses of a DTD which this project does not use. I will look at registering a String array of entities that will be recognised. This will work for both reading and writing.