xPath looping problem

Home Page Forums BizTalk 2004 – BizTalk 2010 xPath looping problem

Viewing 1 reply thread
  • Author
    Posts
    • #17760

      Hi everyone,

       again i encountered a problem where I don't know how to go on.

      I have a message body which looks like this

      <ns0:Contract xmlns:ns0="http://ClaimSchemas.s_ExcelContract">
        <OrgFileName>C:\Filedrop\test_8.xls</OrgFileName>
          <Products>
          <Product>
            <ProdNr>0</ProdNr>
            <StzThis>0.23</StzThis>
            <StzLast>0.23</StzLast>
            <NetPrice>0</NetPrice>
            <GHRabatt>0.46</GHRabatt>
            <Menge>0</Menge>
          </Product>
        </Products>
        <LAUFZEIT_V>2006-10-01T00:00:00</LAUFZEIT_V>
        <LAUFZEIT_B>2006-12-31T00:00:00</LAUFZEIT_B>
      </ns0:Contract>

      Products can occur multiple times. I wanted to loop through the message with

      ContractProduct = xpath(ExcelContract, "/*[local-name()='Contract' and namespace-uri()='http://ClaimSchemas.s_ExcelContract'%5D/*%5Blocal-name()='Products&#039; and namespace-uri()=''/*[local-name()='Product' and namespace-uri()=''][" + strCount + "]");

       but it tells me "invalid token" which seems to reference to the strCount number. I tried starting the strCount with 0 and 1 but neither worked… has anyone an idea what i might miss?

      Regards,

      Julian

    • #17764

      I guess is that you forgot to close your bracket after 'Products' and namespace-uri=''

      try this:

      "/*[local-name()='Contract' and
      namespace-uri()='http://ClaimSchemas.s_ExcelContract'%5D/*%5Blocal-name()='Products&#039;
      and namespace-uri()='']/*[local-name()='Product' and
      namespace-uri()=''][" + strCount + "]");

       -weak architect

      • #17789

        Yes this solved the problem.

        But now i should be able to access the values inside the ContractProduct Message if I the fields are distinguished or do I miss something? Because I try to access them and send them to a .Net helper but all values are set to "Nothing". Now I thought the message assignment might not work but the output message which I store on disk contains all the values…

        Any Ideas?

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.