No subject

Fri Aug 6 17:04:17 PDT 2004

&entityName; in your output as expected.

The problem is in SAXBuilder.  While both Xerces 1.2 and Crimson return a
value (true) for the feature, they both throw an
exception if you try to set the feature.  Since this is part of the SAX 2.0,
we should assume that at some point the parsers will support the feature.  I
haven't tried Xerces 1.3 yet but it may be supported there already.

It seems that I can 
- wait until the parsers support the feature to implement no expansions in
- work around the issue by passing the expand flag to the handler and
manually building the EntityRefs from the elsewhere in the sax api.

If we think that SAX 2.0 compliance is just around the corner, I would say
wait since it will likely be more standard behaviour across parsers.  Both
options should be doable.

The next thing in this path is to build a content string in DocType for the
internal dtd subset.  Shouldn't be too hard and I think that may be useful
to people now.  Or not...

In DOMBuilder, a separate but related issue prevents me from expanding the
entities at all but that is not new so I won't do much about it until the
SAX issue is handled.  For now, DOMBuilder will put EntityRefs when it
encounters entities (but without public or system ids like now).  The issue
is that since we don't build from a file, we don't actually have much
control over what we get.  Features are far less standard anyway.  Here, I
think going to the Document for the internal subset makes more sense and
this is pretty easy from my 10 minute glance.  Again, I need to pass a flag
to the builder to indicate what to do.

Jason, since there are a lot of changes, I'll send the source to you or
anyone who explicitly asks for it and is willing to do a little testing.  I
attached a file listing the changed classes and hopefully all the methods.

Content-Type: text/plain;
Content-Disposition: attachment;

Element - addContent for EntityRef, clone(), removeContent(EntityRef), setMixedContent()

Entity deleted
EntityRef added

SAXBuilder - removed import for Entity, added setExpandEntities(boolean expand), member variable
expand, build(InputSource) to set feature 

DOMBuilder - buildTree ENTITY_REF_NODE for entity name
DOMOutputter - output()

IllegalAddException - IllegalAddException(Element base, EntityRef added, String reason)

XMLOutputter - change Entity to EntityRef import, printElementContent(), printEntity() to printEntityRef()
output(Entity, Writer) to output(EntityRef, Writer), output(Entity entity, OutputStream out) to
output(EntityRef entity, OutputStream out)

SAXHandler - ignorableWhitespace added, changed startEntity, endEntity, startElement, characters


More information about the jdom-interest mailing list