On Fri, 2008-09-19 at 12:29 +0200, Thorsten Scherler wrote: > On Fri, 2008-09-05 at 14:59 +0200, Thorsten Scherler wrote: > > Hi all, > > > > I will have some time in the next week to enhance the performance of the > > dispatcher. The performance always have been the Achilles’ heel of the > > dispatcher. > > Regarding the implementation of the hook processing. > > There is a small downsides in the current implementation: the xpath > injection are NOT working well when the injection point is within the > main stream of the events.
Some interesting links around the topic: http://www.idealliance.org/proceedings/xml04/papers/226/BuildingXPathFramework.html http://www.theserverside.com/discussions/thread.tss?thread_id=47577 http://acs.lbl.gov/nux/ salu2 > > It is possible to inject e.g. to /html/head but injecting > to /html/body/... will not inject the new events in the principal stream > to the location that one w > ould await. The main reason is that the generation of the result > document is now as well based on StAX and not any more in DOM. > > However to have the same behavior as we have currently in the > DispatcherTransformer I do not see any other possibility then using DOM > again. > > Like with the xml properties I will make the usage configurable since I > reckon in 90% of all cases the StAX based calculation is used. For the > rest I am stil > l investigating but it seems that DOM is the only possibility because > every other possibility that me occur is imitating DOM. > > For the > dispatcher/testing/org/apache/forrest/dispatcher/master.structurer.xml > that I am using for testing I get: > <?xml version='1.0' encoding='UTF-8'?> > <html> > <body> > > <!-- the normal stream of contract no xpath used in contract > Using the xpath from structurer--> > > <hook id="example"> > Content going to the location defined by the structurer. > $test-inline: position:hook/contract $test-inline-xml: No xml > parameter has been passed > <hook id="level2"> Content going to the location defined by the > structurer. $test-inline: position:hook/hook/contract > $test-inline-xml: No xml parameter has been passed</hook> > </hook> > Another test! $test-inline: xxx $test-inline-xml: No xml parameter > has been passed > </body> > > <!-- xpath injection but to a path not in structurer default path --> > > <head> > <meta name="Description" > content=" Content going to a fixed location defined by the > contract (here: /html/head)." /> > <meta name="Description" > content=" Content going to a fixed location defined by the > contract (here: /html/head)." /> > <meta name="Description" content="m2 - another test" /> > </head> > > <!-- Injections from the contract to a specific xpath --> > <body> > <hook> > <hook> > <p>master-xxx</p> > <p>master-xxx</p> > </hook> > </hook> > </body> > </html> > > Like you can see the 3 part is not in the desired nodes. > > To solve this, one need to localize the stream event that comes the > closest to the xpath expression and then inject new events there. > > Somebody has an idea? > > Meanwhile I will add the DOM result creation as alternative. > > salu2 -- Thorsten Scherler thorsten.at.apache.org Open Source Java consulting, training and solutions