BTS 2006 and xpath question

Home Page Forums BizTalk 2004 – BizTalk 2010 BTS 2006 and xpath question

Viewing 1 reply thread
  • Author
    Posts
    • #20320

      I am new to BizTalk and only familiar with xpath.  I have a xml document that will look something like this that will come into an orchestration via several receive ports.

      <Properties>

      <Dictionary>

           <key> </key>

           <value> </value>

      </Dictionary>

      </Properties> 

       

      the key and value nodes will repeat for all the settings (like a typical app.config).   What I need to do is either update the value node under dictionary where the key node has a value of X.  If there is no key node with a value of X then I need to create new key/value nodes with the key node value of X and the value node with a value of some variable.

      I’m not sure how I would do this in a construct message shape in an orch.  I think I would just use the xpath function on the message I am creating.  Basically this message is a copy of another message.  So I have NewMessage = OriginalMessage; NewMessage(*) = OriginalMessage(*);

      I then need to update (or create) the key/value nodes under Dictionary as explained above.  Is this possible?  If so, what would the xml look like?  Also I am assuming that if I used an xpath expression to update the value node where the key node = X and the key node with value of X does not exist, then it will NOT create it for me automatically.

      Thanks for any tips and help!

       

    • #20322

      Here is a blog on how to do XPATH with namespaces (which BizTalk normally adds):

      http://nealwalters.blogspot.com/2005/01/common-xpath-examples-questions-issues.html 

      I suggest using a tool like StylusStudio or XML-Spy to test your XPath, then copy/paste a working one into BizTalk.  This can save a lot of time!

      Here is a brief blog on how to use XPATH in a Biztalk Expression shape.  As it says, don’t forget the keyword “string()” around your xpath. Also see BizTalk documentation for how this works.

      http://geekswithblogs.net/andym/archive/2006/12/06/100475.aspx

      As far as I know, the XPath command in BizTalk cannot add nodes.  You have to call a C# helper class.

      Here are two examples of how to add a node to an XML document using a C# helper method. 

      http://biztalk-training.com/administration/articles.php?article_id=14

      Neal Walters
      http://BizTalk-Training.com – Learn BIzTalk with Videos

       

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