Hi Michael,
I want to hold the project "Asynchronous LSParser and parseWithContext" as
my GSoC 2010 proposal,and I have been researching
Xerces's code for a long time. I will tell you my idea about this project
and expecting for your advises.
In Xerces-J 2.9.1's code,class org.apache.xerces.parsers.DOMParserImpl
implements interface LSParser,but DOMParserImpl does not support
asynchronous mechanism,if we want to make DOMParserImpl support asynshronous
mechanism,we can achieve it by the following two steps:
1.DOMParserImpl should implements interface EventTarget
Use a Vector ojbect (we name it *repository*) to store all the action
listeners registered in the current LSParser object.Each of
the action listener is made up of three parts,*type,useCapture *and* event
handler function*. And then,we need achieve function
*addEventListener,dispatchEvent* and* removeEventListener*.
*addEventListener*: just add a action listener object in to *repository*.We
should notice that listener with the same parameters can
only be added once.
*dispatchEvent*:traverse each item of repository,if some one has the same
type value with the event and its useCapture value is
true,let's dispatch its *handleEvent* function.
*removeEventListener*: traverse each item of repository,if some one is the
same as the object in the parameter,just remove this
item from repository.
2.implement asynchronous mechanism
When DOMParserImpl object's parse() function is dispatched,set *busy* value
true, start a Thread to parse XML document in
LSInput,and then return null value. When XML parse thread finish its parse
job,set *busy* value false,create a LSLoadEvent object
with type value *load*,dispatch function *dispatchEvent(Event evt)*.If user
register any actionlistener for load event,finish the
job defined in actionlistener's *handleEvent* function.
Implement function parseWithContext(LSInput input, Node contextArg, short
action)
parseWithContext is a synchronous function (even if LSParser is in
asynchronous model). I think its implemention is simple (may
be because i am naive), we just use DOMParserImpl's parse(LSInput input)
function parse LSInput stream to a DOM tree, and merge this DOM tree with
Node contextArg according parameter action, then return the result DOM tree.
This is my mainly idea about this project,if you have any ideas,please let
me know,thank you!
Best regards
2010/3/11 Michael Glavassevich <[email protected]>
> Hi Yin,
>
> Welcome to the mailing list. The LSParser project from the GSoC 2009 idea
> list is still available this year if you're interested.
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: [email protected]
> E-mail: [email protected]
>
> Yin Lei <[email protected]> wrote on 03/09/2010 10:51:39 PM:
>
> > Hi guys,
>
> >
> > I am interested about the project "Asynchronous LSParser and
> > parseWithContext" at Gsoc 2009 idea list.And i noticed that this
> > project have not been done yet,so,i have been learning some
> > background knowledge about this project, and want to hold this
> > project as my GSoC 2010 proposal. But i am not sure whether this
> > subject will remain this year or not.Can anyone tell me?
> >
> > Thank you & best regards
>