6 Replies Latest reply on Sep 4, 2007 7:29 PM by andres.testi

    ExpressionLanguage Vs. XPath

    andres.testi

      Hi people:

      I think XPath is a powefull expresion language, and has high selection skills. The apache JXPath project, allows we to use XPath over beans and define new functions, just like our java ExpressionLanguage does. Are there technical restrictions to implement XPath as alternative to ExpressionLanguage? I'm thinking in use an special char to mark XPath, just "#" and "$" in traditional expression languaje ( maybe &{ ... } , %{ ... } or @{ ... } I don't know ).
      What do you think?

      Andrés

        • 1. Re: ExpressionLanguage Vs. XPath
          andres.testi

          I'm sorry for my grammatical faults, I'm not an native english speaker :P

          • 2. Re: ExpressionLanguage Vs. XPath

            The limitations of regular EL prompted the Seam EL extensions in jboss-el. We'd like to further enhance the EL, but I'm not sure XPATH itself is the best approach. The selection notion might work ok for values, but we also need a method expression syntax. It would be great to borrow some things from xpath for EL. If there is interest in the community, we can definitely look at a more formal development structure for jboss-el.

            • 3. Re: ExpressionLanguage Vs. XPath
              andres.testi

              method expression can be done with a special Seam defined XPath function like s:call(object, method, argument1, argument2...) . Then, s:call(enterprise, createEmployee, "andres") has the same effect than enterprise.createEmployee("andres")
              I know this solution is not coolest than the point operator, but it works.

              • 4. Re: ExpressionLanguage Vs. XPath

                As I said, I'd rather focus on improving EL, but that shouldn't stop you from exploring the other possibilities. In working on jboss-el, we discovered that the web servers (tomcat, in specific) are very sensitive to the EL and will try to parse the EL. There's very little you can do there. With some help from facelets, you could probably make xpath work there. Beyond that, you need to look at the integration options provided by whatever technologies you are interested in.

                • 5. Re: ExpressionLanguage Vs. XPath
                  andres.testi

                  Thanks for your suggestions, norman! Apache JXPath is very extensible. I will try to create an extension for Seam ;)

                  • 6. Re: ExpressionLanguage Vs. XPath
                    andres.testi

                    I've found that bean methods in JXPath, are invoked as functions. An invocation to enterprise.createEmployee("name") is invoked as createEmploye(enterprise, "name"). The target of the message is the first argument in the function call.