[ 
https://issues.apache.org/jira/browse/WSCOMMONS-346?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Veithen updated WSCOMMONS-346:
--------------------------------------

    Fix Version/s: Axiom 1.2.9

I think that the issue is in OMChildrenQNameIterator#next(), which advances to 
the next child before returning the current child. Advancing to the next child 
should only be done in hasNext().

Since this is only an optimization question and there is a risk of breaking 
things, let's schedule it for 1.2.9, i.e. for the next minor release after the 
one planned for this month.

> getFirstChildWithName should not read the next element.
> -------------------------------------------------------
>
>                 Key: WSCOMMONS-346
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-346
>             Project: WS-Commons
>          Issue Type: Improvement
>          Components: AXIOM
>            Reporter: Jose Antonio
>            Priority: Minor
>             Fix For: Axiom 1.2.9
>
>
> When calling getFirstChildWithName operation over an element, it reads not 
> only the first element, but the next also. I think that could be improved 
> since the operation name semantics specifies that the caller is only 
> interested in the first element and not the rest of them, so a iterator (the 
> reason to read the next element) is useless here. Suppose the following 
> scenario.
> <root-element>
>   <chlid-element att="value">
>      <sub-child-element>
>           -- very big content --
>      </sub-child-element>
>   </child-element>
> </root-element>
> I want to read the sub-child-element only in some cases depending on the 
> 'value' attribute. If I call to getFirstElement I get the behaviour I want, 
> since only the header is readed and I can skip and discard the message if it 
> doesn't match. I get the behaviour that I would expect from a StaX parser and 
> a getFirst* method, so I can discard the message quickly. Instead, 
> getFirstElementWithName seems to call internally to getElementsWithName and 
> returns the first occurence, which forces the parser to read the next element 
> and (in this case) the complete big message.
> I think that the efficiency of that method could be improved since, for a 
> StaX model, one expects that the parser only reads the minimal information 
> needed to serve the request. Instead of calling to getElementsWithName, it 
> would be better an implementation based on getFirstElement and then going 
> through getNextOMSibling.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to