[ 
http://issues.apache.org/jira/browse/WSCOMMONS-76?page=comments#action_12438573 
] 
            
Takahide Nogayama commented on WSCOMMONS-76:
--------------------------------------------

Eran, 

I was missunderstanding 2, sorry. I will explain 2 reasons below, why we should 
insert filter in StAXBuilder.

If we create filter instance before creating StAXBuilder and put it into 
StAXBuilder Constructor, filter can not get bulider. For Example, 
the following code can do same as my ver3_patch.
-----------------------------------------------------------------------------------------
XMLStreamReader reader = new createXMLStreamReader(inStream, charSetEnc) ;
Filter filter = FilterRegistry.getFilter( reader );
StAXBuilder builder = new StAXBuilder( filter );
filter.setBuilder( builder );    // I do not like this line.
-----------------------------------------------------------------------------------------
In this approach, we have to set builder to filter after creating StAXBuilder. 
I think this is not easy for programer.
One of main reason of setting builder to filter is that we can use past 
information from OM tree. 
If we can not use OM tree, Filter have to store the information to local 
variables. see also http://issues.apache.org/jira/browse/WSCOMMONS-75.

And, StAXOMBuilder have constructor whose input argument is not 
XMLStreamReader. In other word, String or InputStream can go into constructor 
of StAXBuilder and 
XMLStreamReader is created from the String or the InputStream in constructor. 
If we create filter instance before creating StAXBuilder, we can not set filter 
against these cases.


> StAX Filter [ Data conversion, extraction, or do something between 
> XMLStreamReader and StAXBuilder]
> ---------------------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-76
>                 URL: http://issues.apache.org/jira/browse/WSCOMMONS-76
>             Project: WS-Commons
>          Issue Type: New Feature
>          Components: AXIOM
>         Environment: windows
>            Reporter: Takahide Nogayama
>         Attachments: patchAXIOM_to_moduleaxiom-apisrcmainjava.txt, 
> patchAXIS2_to_moduleskernelsrc.txt, src_demo.zip, 
> StAX_filter_architecture.ppt, 
> ver2_patch_to_axiom_modules_axiom-api_src_main_java_org_apache_axiom_om_impl_builder.txt,
>  ver2_patch_to_axis2_modules_kernel_src_org_apache_axis2_transport.txt, 
> ver3_patch_to_axiom_modules_axiom-api_src_main_java.txt, ver3_src_demo.zip
>
>
> Filter is interface and extends XMLStreamReader. Filter wraps 
> XMLStreamReader. And XMLStreamReader of StAXBuilder is replaced by Filter.
> In building phase, next() method must be invoked on each event. filter get 
> result of next() from XMLStreamReader, and do some process, then return the 
> result to StAXBuilder.
> We can set Object on filter. Filter get some information from it and set 
> result on it to transfer the result.
> We can set StAXBuilder on filter. Filter get OMDocument from the builder. If 
> filter want to know past information, the OMDocument has it.
> If StAXBuilder has lastNode() method, Filter can make reference list to 
> OMNode. this is commneted in 
> http://issues.apache.org/jira/browse/WSCOMMONS-75 .
> Example1)
> SOAP header has some child elements. and they has actor Attribute. it 
> indicates which intermediary should process the element.
> ExtractMyActorSOAPHeaderFilter.java is implementation of Filter for this 
> example. The filter monitors locaName at first,
> If START_ELEMENT whose actor does not equals myactor is found, The filter 
> invokes next() until the element's END_ELEMENT.
> Thus, The soap header elements which has other's actor are not transfered to 
> StAXBuilder. We can ommit creating fruitness OM.
> Example2)
> If StAXBuilder has lastNode() method, Filter can make reference list. The 
> list has OMNode whose actor indicates myactor.
> After building, If we want to access Security header elements which has 
> myactor, we can access the element directry by using the reference list.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to