You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Raul Kripalani (JIRA)" <ji...@apache.org> on 2012/06/27 13:37:43 UTC

[jira] [Created] (CAMEL-5403) Type converter for NodeList with size 1 to Node

Raul Kripalani created CAMEL-5403:
-------------------------------------

             Summary: Type converter for NodeList with size 1 to Node
                 Key: CAMEL-5403
                 URL: https://issues.apache.org/jira/browse/CAMEL-5403
             Project: Camel
          Issue Type: New Feature
          Components: camel-core
    Affects Versions: 2.8.0
            Reporter: Raul Kripalani


In many cases, Xerces will return transformation results as a NodeList of size 1 even though the XPath evaluation only yields one element during runtime.

{code}
<transform>
   <xpath>/child::node()[local-name() = 'ABC']</xpath>
</transform>
{code}

(that XPath is capable of matching multiple elements - but let's assume only one is matched)

When applying an XPath choice afterwards, it is easy to come across this error:

{code}
java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMNodeList cannot be cast to org.w3c.dom.Node
	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:121)[:]
	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)[:]
	at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184)[:]
	at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:676)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
	at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:640)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
	at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:132)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:65)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
[...]
{code}

To make the out-of-the-box experience smoother, I propose adding a little type converter that converts from NodeList => Node when the size of the former is 1.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CAMEL-5403) Type converter for NodeList with size 1 to Node

Posted by "Raul Kripalani (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani reassigned CAMEL-5403:
-------------------------------------

    Assignee: Raul Kripalani
    
> Type converter for NodeList with size 1 to Node
> -----------------------------------------------
>
>                 Key: CAMEL-5403
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5403
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>              Labels: type-converter, xerces, xpath
>         Attachments: single-nodelist-converters_CAMEL-5403.diff
>
>
> In many cases, Xerces will return transformation results as a NodeList of size 1 even though the XPath evaluation only yields one element during runtime.
> {code}
> <transform>
>    <xpath>/child::node()[local-name() = 'ABC']</xpath>
> </transform>
> {code}
> (that XPath is capable of matching multiple elements - but let's assume only one is matched)
> When applying an XPath choice afterwards, it is easy to come across this error:
> {code}
> java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMNodeList cannot be cast to org.w3c.dom.Node
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:121)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184)[:]
> 	at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:676)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:640)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:132)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:65)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> [...]
> {code}
> To make the out-of-the-box experience smoother, I propose adding a little type converter that converts from NodeList => Node when the size of the former is 1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-5403) Type converter for NodeList with size 1 to Node

Posted by "Raul Kripalani (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-5403:
----------------------------------

    Labels: type-converter xerces xpath  (was: )
    
> Type converter for NodeList with size 1 to Node
> -----------------------------------------------
>
>                 Key: CAMEL-5403
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5403
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Raul Kripalani
>              Labels: type-converter, xerces, xpath
>
> In many cases, Xerces will return transformation results as a NodeList of size 1 even though the XPath evaluation only yields one element during runtime.
> {code}
> <transform>
>    <xpath>/child::node()[local-name() = 'ABC']</xpath>
> </transform>
> {code}
> (that XPath is capable of matching multiple elements - but let's assume only one is matched)
> When applying an XPath choice afterwards, it is easy to come across this error:
> {code}
> java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMNodeList cannot be cast to org.w3c.dom.Node
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:121)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184)[:]
> 	at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:676)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:640)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:132)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:65)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> [...]
> {code}
> To make the out-of-the-box experience smoother, I propose adding a little type converter that converts from NodeList => Node when the size of the former is 1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-5403) Type converter for NodeList with size 1 to Node

Posted by "Raul Kripalani (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-5403:
----------------------------------

    Attachment: single-nodelist-converters_CAMEL-5403.diff

Attached patch including unit tests.
                
> Type converter for NodeList with size 1 to Node
> -----------------------------------------------
>
>                 Key: CAMEL-5403
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5403
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.8.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>              Labels: type-converter, xerces, xpath
>         Attachments: single-nodelist-converters_CAMEL-5403.diff
>
>
> In many cases, Xerces will return transformation results as a NodeList of size 1 even though the XPath evaluation only yields one element during runtime.
> {code}
> <transform>
>    <xpath>/child::node()[local-name() = 'ABC']</xpath>
> </transform>
> {code}
> (that XPath is capable of matching multiple elements - but let's assume only one is matched)
> When applying an XPath choice afterwards, it is easy to come across this error:
> {code}
> java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMNodeList cannot be cast to org.w3c.dom.Node
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:121)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184)[:]
> 	at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:676)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:640)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:132)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:65)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> [...]
> {code}
> To make the out-of-the-box experience smoother, I propose adding a little type converter that converts from NodeList => Node when the size of the former is 1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-5403) Type converter for NodeList with size 1 to Node

Posted by "Raul Kripalani (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani resolved CAMEL-5403.
-----------------------------------

    Resolution: Fixed
    
> Type converter for NodeList with size 1 to Node
> -----------------------------------------------
>
>                 Key: CAMEL-5403
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5403
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.8.0, 2.9.2, 2.10.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>              Labels: type-converter, xerces, xpath
>             Fix For: 2.10.1
>
>         Attachments: single-nodelist-converters_CAMEL-5403.diff
>
>
> In many cases, Xerces will return transformation results as a NodeList of size 1 even though the XPath evaluation only yields one element during runtime.
> {code}
> <transform>
>    <xpath>/child::node()[local-name() = 'ABC']</xpath>
> </transform>
> {code}
> (that XPath is capable of matching multiple elements - but let's assume only one is matched)
> When applying an XPath choice afterwards, it is easy to come across this error:
> {code}
> java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMNodeList cannot be cast to org.w3c.dom.Node
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:121)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184)[:]
> 	at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:676)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:640)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:132)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:65)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> [...]
> {code}
> To make the out-of-the-box experience smoother, I propose adding a little type converter that converts from NodeList => Node when the size of the former is 1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-5403) Type converter for NodeList with size 1 to Node

Posted by "Raul Kripalani (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-5403:
----------------------------------

           Patch Info: Patch Available
    Affects Version/s: 2.9.2
                       2.10.0
        Fix Version/s: 2.10.1
    
> Type converter for NodeList with size 1 to Node
> -----------------------------------------------
>
>                 Key: CAMEL-5403
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5403
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.8.0, 2.9.2, 2.10.0
>            Reporter: Raul Kripalani
>            Assignee: Raul Kripalani
>              Labels: type-converter, xerces, xpath
>             Fix For: 2.10.1
>
>         Attachments: single-nodelist-converters_CAMEL-5403.diff
>
>
> In many cases, Xerces will return transformation results as a NodeList of size 1 even though the XPath evaluation only yields one element during runtime.
> {code}
> <transform>
>    <xpath>/child::node()[local-name() = 'ABC']</xpath>
> </transform>
> {code}
> (that XPath is capable of matching multiple elements - but let's assume only one is matched)
> When applying an XPath choice afterwards, it is easy to come across this error:
> {code}
> java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMNodeList cannot be cast to org.w3c.dom.Node
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:121)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99)[:]
> 	at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184)[:]
> 	at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:676)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:640)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:132)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> 	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:65)[88:org.apache.camel.camel-core:2.8.0.fuse-03-06]
> [...]
> {code}
> To make the out-of-the-box experience smoother, I propose adding a little type converter that converts from NodeList => Node when the size of the former is 1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira