Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Exposing XMLHandler

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Alan Gutierrez <alan AT blogometer.com>
  • To: elharo AT metalab.unc.edu
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Exposing XMLHandler
  • Date: Wed, 26 Sep 2007 20:35:00 -0500

I am already using SAXConverter to generated SAX events.

I want to create an XOM document by consuming events. XOMHandler consumes SAX events and produces an XOM document. It also performs checks to prevent the creation of a malformed document, because if it were provided with an XMLFilter that XMLFilter could call ContentHandler methods out of order.

The XOMHandler is almost public as it is. I'm able to create a bogus XMLReader and pass it to a new Builder. Then I can get the ContentHandler and LexicalHandler from the XOMHandler. I can give the ContentHandler and LexicalHandler to the library that expects it. Then I can obtain the generated XOM document by calling the parse method of Builder, which in turn calls the do nothing parse method my bogus XMLReader and returns the XOM document created by manipulating the ContentHandler and LexicalHandler outside of the XMLReader.

The XMLHandler is almost exposed and nothing about making it package visible prevents the creation of malformed documents. The implementation of SAXConverter recognizes that ContentHandler and LexicalHandler are interfaces that are used outside of the context of SAX filter chain.

Which is why I still don't understand why XOMHandler is not public.

On Sep 26, 2007, at 7:02 PM, Elliotte Harold wrote:

Alan Gutierrez wrote:
I have a program that builds an XML document by sending messages to a content handler and lexical handler. I would like to build XML documents in this way. XMLHandler would do this for me, but it has package scope.
Why not make XMLHandler a public class?

Because that would enable the creation of malformed documents.

Chances are that is another way to do whatever it is you want done. Possibly you need to look at the SAXConverter class instead.

http://xom.nu/apidocs/nu/xom/converters/SAXConverter.html


--
Alan Gutierrez | alan AT blogometer.com | http://blogometer.com/ | 504 717 1428
Think New Orleans | http://thinknola.com/






Archive powered by MHonArc 2.6.24.

Top of Page