[jdom-interest] xni builder

rpcee rpcee at operamail.com
Thu Nov 8 02:02:39 PST 2001


I've been recasting the XNIBuilder in Java and fixing the bugs/missing bits 
(namespace handling) by following the SAXBuilder stuff, and come across a few 
questions:

1. SAXHandler DTD processing

      PIs in the external or internal DTD become part of the Document. Is it 
legal for PIs to appear in DTDs? Xerces 2 accepts them. Should PIs in the 
internal subset become part of the doc, copied as String to the internal 
subset, or both?

      Comments in the external DTD are copied to the internal DTD subset. I 
can prevent this in XNIBuilder - should I? Can/should SAXHandler

      NOTATIONs in the internal DTD subset are copied as a String minus the 
publicId

      NOTATIONs in the external DTD are copied to the internal DTD subset 
(again minus public Id)

      If there is no internal DTD subset in the source document, the JDOM 
internal subset is set to the empty string and appears when the document is 
serialised, ie
         <!DOCTYPE personnel SYSTEM "personal.dtd" [
         ]>
      Is this by design, should the subset be set to null, or should the 
outputter not output blank internal subsets?


2. XNI Builder

      Building the internal DTD means I have copied all the buffer.append() in 
SAXHandler. I've moved this into a BuilderHelper class which just contains 
static methods to append the string representation of comments etc to a 
buffer.
      NOTATIONs don't appear to be represented in JDOM? (No Notation class)

      Here's my current list of todos.
         complete internal DTD subset stuff.
         error handling
         add all the build() methods from SAXBuilder
         accessor methods for ignorablewhite space etc as per SAX builder
         split Builder/Handler
         possibly just add the handlers to a XNI parser configuration (no need 
to extend XMLDocumentParser according to andy clark)
         factories
         javadoc

      How can I test this? For the first stab I'm aiming to build pretty much 
what SAX builder does. Is there a document comparison app that will compare in 
detail two JDOM documents? Then I could build with SAXBuilder, build with 
XNIBuilder, compare the resulting Documents.

How was it envisaged access to the xml decl would be acheived - attributes on 
Document? an XMLDecl class which is an attribute on Document? What happens 
when a JDOM doc is built from SAXBuilder or by hand - default values or null 
values. What would be the logic for outputters to generate the xml decl?


Also, was there an intention to provide access to attribute datatypes?




More information about the jdom-interest mailing list