You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Mikael Helbo Kjær <mh...@dia.dk> on 2000/07/24 09:08:02 UTC

Ideas for the Xerces redesign

I`ve been following the discussion over the last two weeks (or so) on the
Xerces Redesign idea (great save by the IBM guys there) and I think that
Andy posted an idea for a design last week, so this may be redundant but I
had an idea over the weekend which I liked so much that I had to post it
(this is like an ant running under foot of elephants screaming: Down here
look at me!). My idea is simple. The XML Parser in my opinion should be like
this:

						DtdValidation(with or
without the caching feature set)
						SchemaValidation(with or
without the caching feature set)
		   ------------------------------------------   XInclude
		   |				XPath (I saw that in the
requirements but haven`t thought it out yet)
		   |					|
		   v					v
InputSource-->XMLParser---(Event: Like SAX2 method of
processing)--->Interceptors(Validation, XInclude and so on)---(Same event or
new events (maybe from an expanded XInclude node)--->Adapters(to SAX2, DOM,
JDOM)--->Into the big wide world of applications.

The XMLParser would need to have some internal API which allows for
suspension of parsing, resetting of the parser, error handling and some
other internal operations.
There would of course also be some other ErrorHandler and the like. Secondly
this would allow for the easy addition of packages to the parser system (not
initializing the parser with a SchemaValidator) as well as some kind of well
defined set of base interfaces for every interceptor, which would hook into
the internal set of event functions like a multicalling of a SAX function
(e.g. you`d call startTag for each class registered to recieve these
events). Finally you wrap the construction of the DOM/JDOM or the calling of
SAX1/2 in an adapter so that old optimized implementation of this could
still be used or newer solution could be easily incorporated. This is just
my opinion on this and as I do not have the time to produce this myself I
give this to the consideration of the fine members of this community.

If you have questions or criticism, this is expected ;) and I`ll be happy to
answer.

Mikael Helbo Kjær
Software Developer @ DIA a/s

Re: Ideas for the Xerces redesign

Posted by Andy Clark <an...@apache.org>.
Mikael Helbo Kjær wrote:
> InputSource-->XMLParser---(Event: Like SAX2 method of
> processing)--->Interceptors(Validation, XInclude and so on)---(Same event or
> new events (maybe from an expanded XInclude node)--->Adapters(to SAX2, DOM,
> JDOM)--->Into the big wide world of applications.

Wow! I guess great minds think alike. :)

This is basically the idea behind creating the event handlers in
the design so that new pieces can be plugged in to the parser.
And the plugging can be done at any point. For example, XInclude 
can be inserted between the scanner (the source) and the validator. 
The validator would never know what hit it! ;) In other words, the 
included content would appear as if it was always there and the 
validator wouldn't know the difference.

It sounds like you have the same idea as we did. Please check out
the design I posted and let us know if you have any ideas for
additions or modifications.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org