4 Replies Latest reply on Nov 6, 2007 10:51 AM by HowardTreisman

    XPath and XML nodes


      I've a simple problem but can't figure out the solution in ES Workbench (Process Designer). My process uses a xml variable called xmlvar that looks like:

                     form 1

                     form 2

                     form 3



      For example: I want to get the name of the second anyform element. My index is stored in a counter variable called posCount (type int) and the value is 1. I've tried the XPath selection:

      That doesn't work. I'm always getting the first value ("form 1").

      Anybody know why?
        • 1. Re: XPath and XML nodes
          Jasmin Charbonneau Level 4
          I have copy/pasted your XML into a file and created a process that reads the file from the file system, put the content into an XML variable and then use /process_data/xmlvar/data/formList/anyform[2]/name to put the name in a string variable and I do get "form 2".

          Are you sure you're xml variable is populated properly? Can you put a variable logger before your SetValue to double check the content of the variable?

          • 2. Re: XPath and XML nodes
            Level 1
            Strewth! This one was nasty... but finally I made it.

            My approach had two failures:
            * xml nodes, maps, list have not 0-based but 1-based indexes
            * the statement has wrong syntax (but this doens't result in an exception!!)

            Ok, the correct statement look like this if your index is also a variable:

            That's it!
            • 3. Re: XPath and XML nodes
              Level 1
              Thanks Jasmin for your great support!
              Unfortunately I could solve my problem (almost) in the same minute as you were testing my problem.... sorry.

              • 4. Re: XPath and XML nodes
                HowardTreisman Level 1
                Hi Nico
                The xpath expression probably doesn't throw an exception because it's still a valid xpath expression, it just doesn't result in the data that you're expecting.

                What would be very helpful in xpath expressions is a way of evaluating an xpath expression against the real data of a particular process instance. If you feel this would be useful, please log it as a feature request with Adobe.