Hi Thiwanka,

Thiwanka Somasiri <asthiwa...@gmail.com> wrote on 03/31/2011 08:21:55 AM:

> Hi Michael,
>
>                  By using a synthesized wrapper XML document, does
> it mean to convert the fragment to a temporary complete XML document
> (using a dummy root - so it can be parsed like a normal XML
> document), parse it and merge the nodes created with this to the
> existing document? If so, whenever the fragment contains an
> erroneous point, an exception will be thrown. Otherwise we can
> extract the relevant nodes to the XML fragment (removing dummy root
> nodes) and add them to the existing document.

Right, that's what I meant, though you're not really 'converting' the
fragment, but including it by reference in a dummy wrapper XML document so
that it can be parsed like any other XML document. The one exception is
when the context node is a Document node and the action is
ACTION_REPLACE_CHILDREN. You would process the input as a whole XML
document, very similar to if the input was parsed using the regular
LSParser.parse() method.

> I have attached an image(http://img145.imageshack.us/i/
> xmlfragmentinsertion.png/) describing what I understood from you
> previous reply. If I have misunderstood that, please correct me.

Your diagram illustrates the idea quite well.

> I am looking for your advices to start with my proposal. I want to
> know what are the key point that should be included and is it enough
> to have high level implementation details in the proposal?

Your proposal should include a high level design for the asynchronous mode
for the LSParser and parseWithContext(), as well as details on your
thoughts for implementation. It should include a plan/timeline for the work
you would be doing, some details about yourself and your development
experience, details about the interaction that you've had with the
community and also say something about the time you would be able to commit
to the project over the summer. Proposals from 2010 are up on the Xerces
Wiki (http://wiki.apache.org/xerces/FrontPage). You may want to take a look
at them to get a better idea of the structure and level of detail in a
successful GSoC proposal.

> Thanks.
>
> On Thu, Mar 31, 2011 at 10:40 AM, Michael Glavassevich
<mrgla...@ca.ibm.com
> > wrote:
> Hi Thiwanka,
>
> Aside from the previous discussion on the mailing list [1] and the
> specification I'm not aware of any good reading material on
> parseWithContext().
>
> I have given the design more thought since last year and think it
> should be possible to implement this method (in the case where the
> context node is not a Document node) by synthesizing a wrapper XML
> document which contains a reference to the fragment and the
> necessary context (e.g. namespace declarations) required to parse
> the fragment. You can then transfer the nodes created for the
> fragment into the existing DOM.
>
> For example, if your existing document looked like this:
>
> <ns1:a xmlns:ns1="http://ns1";>
>  <ns2:b xmlns:ns2="http://ns2"/>
> </ns1:a>
>
> and you wanted to insert an XML fragment like:
>
> <ns2:c/><ns1:d/>
>
> as a child of 'ns2:b', you could generate a wrapper document:
>
> <!DOCTYPE DUMMY_ROOT [
>  <!ENTITY fragment PUBLIC "***" "***">
> ]>
> <DUMMY_ROOT xmlns:ns1="http://ns1"; xmlns:ns2="http://ns2
> ">&fragment;</DUMMY_ROOT>
>
> where the 'fragment' entity points to the XML fragment the user
> provided, parse the document you synthesized and then move the nodes
> created underneath the entity reference into the existing document,
> resulting in:
>
> <ns1:a xmlns:ns1="http://ns1";>
>  <ns2:b xmlns:ns2="http://ns2";><ns2:c/><ns1:d/></ns2:b>
> </ns1:a>
>
> Hope that made sense.
>
> Thanks.
>
> [1] http://markmail.org/thread/ool7dyyzffor6o7b
>
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrgla...@ca.ibm.com
> E-mail: mrgla...@apache.org

> Thiwanka Somasiri <asthiwa...@gmail.com> wrote on 03/28/2011 02:05:24 PM:
>
> > Hi Michael,
>
> >
> > As I understood, the second part of the project is also a critical
> > implementation, which is known as parseWithContext(). According to
> > the W3C specification[1], this method is used to insert a fragment
> > of and XML document to an existing document. The parameters in the
> > method specify the position where the new fragment should be
> > attached and which action should be triggered between the existing
> > document and the new fragment.
> >
> > The implementation also include an error handling part (in a case
> > where the inserting fragment is erroneous,etc) to notify the caller
> > through an ErrorHandler object when an unexpected scenario occur.
> >
> > I need to understand the background for parseWithContext() some more
> > and can you tell me what are the useful resources in this regard.
> > (Understanding the overall idea of this will help me to allocate
> > approximate time in the proposal)
> >
> > I would like to start writing a proposal for the project and I need
> > a big help from you. I am happy if you can give me an starting point
> > and guide lines to write the proposal.
> >
> > [1] http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-
> > save.html#LS-LSParser-parseWithContext
> >
> > Thanks.
> >
> > On Sat, Mar 19, 2011 at 11:41 PM, Michael Glavassevich
<mrgla...@ca.ibm.com
> > > wrote:
> > Hi Thiwanka,
> >
> > Thiwanka Somasiri <asthiwa...@gmail.com> wrote on 03/19/2011 02:25:03
AM:
> >
> > > Hi Michael,
> >
> > >
> > >     Thanks for your reply. I will study more on the project within
> > > next week and come up with both my issues and ideas. Since I was
> > > having my exams, I could not focus much on the project and will be
> > > free after few more days. I hope the support of you all to step
forward.
>
> > That's fine. It's still early on in the process so still quite a bit
> > of time to put together and discuss a proposal.
> >
> >
> > > Thanks.
> >
> > Thanks.
> >
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: mrgla...@ca.ibm.com
> > E-mail: mrgla...@apache.org
> >
> >
> >
> > --
> >
> > Regards
> >
> > A.S.Thiwanka Somasiri
> >
> > Skype : executionerwild
> > MSN   : thi...@ymail.com
>
>
> --
>
> Regards
>
> A.S.Thiwanka Somasiri
>
> Skype : executionerwild
> MSN   : thi...@ymail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-dev-h...@xerces.apache.org

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

Reply via email to