Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: XML
    • Labels:
      None

      Description

      Previously mentioned here:
      http://forum.springframework.org/showthread.php?t=41191

      I will paraphrase in case the forums ever get changed again

      I've built something here that might be a nice addition to an xml-tiger package.

      Basically, it allows me to access xml like this (from my unit test):

      <?xml version="1.0" encoding="UTF-8"?>
      <s:Test xmlns:s="http://www.springframework.org/ws">
        <s:someString>Hello</s:someString>
        <s:anotherString sneaky='boo'>World</s:anotherString>
        <s:booleanExists/>
        <s:booleanTrue>true</s:booleanTrue>
        <s:booleanFalse>false</s:booleanFalse>
        <s:someDouble>123.456</s:someDouble>
        <s:yes>YES</s:yes>
      </s:Test>

      With a proxy generated for an interface that looks like this (again from the unit test):

      @NamespaceMapping(prefix = "s", uri = "http://www.springframework.org/ws")
      public interface Sample {
       
          @XPathMethod("/s:Test/s:someString")
          String getHello();
       
          @XPathMethod("/s:Test/s:anotherString[@sneaky=$0]")
          String getWorld(String sneaky);
       
          @XPathMethod("/s:Test/s:booleanExists")
          Boolean booleanExists();
       
          @XPathMethod("/s:Test/s:doesNotExist")
          Boolean booleanDoesNotExist();
       
          @XPathMethod("/s:Test/s:booleanTrue")
          Boolean booleanTrueValue();
       
          @XPathMethod("/s:Test/s:booleanFalse")
          Boolean booleanFalseValue();
       
          @XPathMethod("/s:Test/s:yes")
          YesNo yesNo();
       
          @XPathMethod("/s:Test/s:someDouble")
          Double doubleValue();
      }

      Quick notes...
      The "getWorld" method uses an XPathVariableResolver to map the method arguments to xpath variables.

      Like the XPathParam stuff in spring-ws, it supports the standard XPath types (String, Boolean, Double, Node, NodeList...). as well as using special Converters.

      YesNo in the example above is an enum, a converter is registered with the XPathProxyFactory that allows the conversion of a string to some object.

      XPath Booleans are touchy, they are based on existence, not content. This is the default behavior for the XPath proxy as well. Registering a Converter for Booleans though allows s:booleanFalse element above to evaluate to 'false'.

      I figured that a spring-xml-tiger package would be a good home for it as it is all JAXP and Annotations. If not, maybe I'll toss it up to sourceforge or googlecode.

      I'll attach a zip containing the code. Mind you it's totally "first-draft" quality; the package is "raykrueger.xpathproxy" and has almost no javadoc yet...

        Issue Links

          Activity

          raykrueger Ray Krueger created issue -
          raykrueger Ray Krueger made changes -
          Field Original Value New Value
          Attachment xpathproxy.zip [ 12714 ]
          Hide
          raykrueger Ray Krueger added a comment -

          xml-tiger is the new upload.

          The package has been changed to org.springframework.xml.xpath.proxy

          I cannot cut the XPath stuff over to the Spring XPathExpression abstractions completely until SWS-159 is complete.

          The XPathProxy stuff relies on XPathVariableResolvers, and that abstraction doesn't exist yet.

          Show
          raykrueger Ray Krueger added a comment - xml-tiger is the new upload. The package has been changed to org.springframework.xml.xpath.proxy I cannot cut the XPath stuff over to the Spring XPathExpression abstractions completely until SWS-159 is complete. The XPathProxy stuff relies on XPathVariableResolvers, and that abstraction doesn't exist yet.
          raykrueger Ray Krueger made changes -
          Attachment xml-tiger.zip [ 12721 ]
          raykrueger Ray Krueger made changes -
          Link This issue depends on SWS-159 [ SWS-159 ]
          Hide
          raykrueger Ray Krueger added a comment -

          I have opened a project for this at google code.
          http://xpathproxy.googlecode.com/

          I decided to do this as the current model doesn't rely on Spring at all an can be used in any java5 application. I was forcing Spring into it rather needlessly.

          I have created a module of the project with spring-ws support for a AbstractXPathProxyPayloadEndpoint.
          http://xpathproxy.googlecode.com/svn/trunk/spring-ws/src/main/java/com/googlecode/xpathproxy/spring/ws/endpoint/AbstractXPathProxyPayloadEndpoint.java
          It extends the AbstractDomPayloadEndpoint so that it can wrap the request elment with the xpath proxy.

          This allows for endpoints to be written that look like...

              public class XPathTargetEndpoint extends AbstractXPathProxyPayloadEndpoint<XPathTarget> {
           
                  public XPathTargetEndpoint() {
                      super(XPathTarget.class);
                  }
           
                  protected Element invokeWithProxy(XPathTarget proxy, Document responseDocument) throws Exception {
                          ................
                  }
              }

          Show
          raykrueger Ray Krueger added a comment - I have opened a project for this at google code. http://xpathproxy.googlecode.com/ I decided to do this as the current model doesn't rely on Spring at all an can be used in any java5 application. I was forcing Spring into it rather needlessly. I have created a module of the project with spring-ws support for a AbstractXPathProxyPayloadEndpoint. http://xpathproxy.googlecode.com/svn/trunk/spring-ws/src/main/java/com/googlecode/xpathproxy/spring/ws/endpoint/AbstractXPathProxyPayloadEndpoint.java It extends the AbstractDomPayloadEndpoint so that it can wrap the request elment with the xpath proxy. This allows for endpoints to be written that look like... public class XPathTargetEndpoint extends AbstractXPathProxyPayloadEndpoint<XPathTarget> {   public XPathTargetEndpoint() { super(XPathTarget.class); }   protected Element invokeWithProxy(XPathTarget proxy, Document responseDocument) throws Exception { ................ } }
          Hide
          raykrueger Ray Krueger added a comment -

          No real reason to submit this to Spring now, so I'll close this.

          Show
          raykrueger Ray Krueger added a comment - No real reason to submit this to Spring now, so I'll close this.
          raykrueger Ray Krueger made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          raykrueger Ray Krueger made changes -
          Assignee Arjen Poutsma [ arjen.poutsma ] Ray Krueger [ raykrueger ]
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          raykrueger Ray Krueger added a comment -

          Sorry, this should be closed as "Won't Fix"

          Show
          raykrueger Ray Krueger added a comment - Sorry, this should be closed as "Won't Fix"
          raykrueger Ray Krueger made changes -
          Resolution Won't Fix [ 2 ]
          Status Reopened [ 4 ] Closed [ 6 ]
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Ok, I still think it's a great idea, and I can totally see why you don't want a Spring dependency. Good luck!

          Show
          arjen.poutsma Arjen Poutsma added a comment - Ok, I still think it's a great idea, and I can totally see why you don't want a Spring dependency. Good luck!
          Hide
          raykrueger Ray Krueger added a comment -

          I am going to re-open this.

          Throwing it up on Google code was done just so I could start using it immediately. Really, having it out there permanently doesn't make since give that the project is like one class

          I'll repackage it and upload it soon. Again, as a submission to a new spring-xml-tiger module.

          Show
          raykrueger Ray Krueger added a comment - I am going to re-open this. Throwing it up on Google code was done just so I could start using it immediately. Really, having it out there permanently doesn't make since give that the project is like one class I'll repackage it and upload it soon. Again, as a submission to a new spring-xml-tiger module.
          raykrueger Ray Krueger made changes -
          Status Closed [ 6 ] Reopened [ 4 ]
          Resolution Won't Fix [ 2 ]
          Hide
          raykrueger Ray Krueger added a comment -

          I'm gonna get this ported over for 1.1, I swear it.

          Show
          raykrueger Ray Krueger added a comment - I'm gonna get this ported over for 1.1, I swear it.
          raykrueger Ray Krueger made changes -
          Fix Version/s 1.1 [ 10543 ]
          arjen.poutsma Arjen Poutsma made changes -
          Component/s XML [ 10200 ]
          Hide
          raykrueger Ray Krueger added a comment -

          I've attached xml-tiger-2007-11-20.zip as the latest, and possibly final, fileset for xml-tiger.

          Show
          raykrueger Ray Krueger added a comment - I've attached xml-tiger-2007-11-20.zip as the latest, and possibly final, fileset for xml-tiger.
          raykrueger Ray Krueger made changes -
          Attachment xml-tiger-2007-11-20.zip [ 13130 ]
          Hide
          raykrueger Ray Krueger added a comment -

          Arjen, would you mind reviewing xml-tiger-2007-11-20.zip?
          Let me know if there are any code changes to be made. None of the files have headers, and probably aren't formatted to the project style.

          I have not included the AbstractXPathProxyPayloadEndpoint in this initial set as it was part of a different module in the original project. I'll work on including that and support for an EndpointAdapter as well.

          Show
          raykrueger Ray Krueger added a comment - Arjen, would you mind reviewing xml-tiger-2007-11-20.zip? Let me know if there are any code changes to be made. None of the files have headers, and probably aren't formatted to the project style. I have not included the AbstractXPathProxyPayloadEndpoint in this initial set as it was part of a different module in the original project. I'll work on including that and support for an EndpointAdapter as well.
          raykrueger Ray Krueger made changes -
          Assignee Ray Krueger [ raykrueger ] Arjen Poutsma [ arjen.poutsma ]
          arjen.poutsma Arjen Poutsma made changes -
          Fix Version/s 1.5 M1 [ 10543 ]
          Fix Version/s 1.5 M2 [ 10720 ]
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Sorry, but I have no time to put this in 1.5 M2. Hopefully, I will have time for 1.5 RC.

          Show
          arjen.poutsma Arjen Poutsma added a comment - Sorry, but I have no time to put this in 1.5 M2. Hopefully, I will have time for 1.5 RC.
          arjen.poutsma Arjen Poutsma made changes -
          Fix Version/s 1.5 M2 [ 10720 ]
          Fix Version/s 1.5 RC1 [ 10652 ]
          arjen.poutsma Arjen Poutsma made changes -
          Fix Version/s 1.5.1 [ 10917 ]
          Fix Version/s 1.5 RC1 [ 10652 ]
          arjen.poutsma Arjen Poutsma made changes -
          Fix Version/s 1.5.1 [ 10917 ]
          Fix Version/s 1.5.2 [ 10966 ]
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Since this feature requires a new module (xml-tiger), I simply cannot introduce this in 1.5.x, as much as I'd like to. Postponing to 1.6.

          Show
          arjen.poutsma Arjen Poutsma added a comment - Since this feature requires a new module (xml-tiger), I simply cannot introduce this in 1.5.x, as much as I'd like to. Postponing to 1.6.
          arjen.poutsma Arjen Poutsma made changes -
          Fix Version/s 1.5.2 [ 10966 ]
          Fix Version/s 1.6 [ 10981 ]
          arjen.poutsma Arjen Poutsma made changes -
          Link This issue is related to SWS-291 [ SWS-291 ]
          arjen.poutsma Arjen Poutsma made changes -
          Fix Version/s 1.6 [ 10981 ]
          Fix Version/s 1.6 M1 [ 11110 ]
          Hide
          raykrueger Ray Krueger added a comment -

          I'm retracting this again heh
          I'm hoping to take this in a different direction that won't involve WS usage.

          Thanks!

          Show
          raykrueger Ray Krueger added a comment - I'm retracting this again heh I'm hoping to take this in a different direction that won't involve WS usage. Thanks!
          raykrueger Ray Krueger made changes -
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Closed [ 6 ]
          arjen.poutsma Arjen Poutsma made changes -
          Status Closed [ 6 ] Reopened [ 4 ]
          Resolution Fixed [ 1 ]
          arjen.poutsma Arjen Poutsma made changes -
          Fix Version/s 2.0 M1 [ 11110 ]
          arjen.poutsma Arjen Poutsma made changes -
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Closed [ 6 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          35d 22h 21m 1 Ray Krueger 16/Aug/07 2:19 AM
          Closed Closed Reopened Reopened
          436d 10h 2m 3 Arjen Poutsma 21/Nov/09 4:05 AM
          Reopened Reopened Closed Closed
          391d 15h 44m 3 Arjen Poutsma 21/Nov/09 4:06 AM

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              raykrueger Ray Krueger
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: