none
Extracting many elements from one node RRS feed

  • Question

  • Hi All,

    I have a scenario where I get a message with an ANY Node. There are as many as 15 elements that come out of it. I need to extract each as a separate element.

    <Root>
     <User>
      <Any/>
     </User>
    </Root>
     
     The actual XML message when it comes would look like this
     
    <Root>
     <User>
      <A/>
      <B/>
      <C/>
     </User>
    </Root>

    I need to extract the above as the following from the input and map to other fields.
     
    <A/>
    <B/>
    <C/>

     

    Any Help is really appreciated.

     

    Wednesday, November 10, 2010 6:39 PM

Answers

  • Hi All,

    Thanks for all your help. I found a solution ins XSLT.. I wrote my entire map in XSL and it is working fine.

    Friday, November 12, 2010 2:33 PM

All replies

  • Hi,

    In an Expression shape inside an orchestration you can use the xpath function to select a piece of data, an element or a value from an element,.

     Example:
    // Extract a single piece of data out of a Message
    sCustomer = xpath(InXML,"string(//*[local-name()='A'])");

    Selecting Nodes:
    // Selects nodes in the document from the current node that match the selection no matter where they are 

    greetings,

    Tomasso Groenendijk

     

    Thursday, November 11, 2010 12:26 PM
  • The XPath expression will debatch but you end up with an Xml fragment without a namespace on it. So when I use the XPath expression I always have a follow on .NET method to rewrap it with a namespace. In your case you are going to be better off just going with the .NET method to handle it.

    Thanks, 


    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Thursday, November 11, 2010 1:50 PM
    Moderator
  • Hi Prav,

    You can take a look at building custom pipeline component. You need to implement Icomponent Interface and with Execute method.

    you can convert the message to XML Document and perfrom Pharsing. If XMl Document format is as needed you can just change the namespace of the message to new xsd schema whch had your required stutcture with 15 elements.

    Friday, November 12, 2010 2:16 PM
  • Hi All,

    Thanks for all your help. I found a solution ins XSLT.. I wrote my entire map in XSL and it is working fine.

    Friday, November 12, 2010 2:33 PM