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


      Previously mentioned here:

      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="">
        <s:anotherString sneaky='boo'>World</s:anotherString>

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

      @NamespaceMapping(prefix = "s", uri = "")
      public interface Sample {
          String getHello();
          String getWorld(String sneaky);
          Boolean booleanExists();
          Boolean booleanDoesNotExist();
          Boolean booleanTrueValue();
          Boolean booleanFalseValue();
          YesNo yesNo();
          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


          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


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


              • Created: