none
Regarding CDATA in BizTalk orchestration RRS feed

  • General discussion

  • Hello,

    I am polling data from SQL server using Typed  polling and bellow is the my result.In my orchestration i want to loop through one by one and extract  CDATA content and assign it to another schema and continue with other processing.I am having hard time in extracting CDATA. can you guys look at it.

    I have tired  msgnew=xpath(msgsqlpolllingresult,"string(xpath)") but no luck...

    <TypedPolling xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test">
      <TypedPollingResultSet0>
        <TypedPollingResultSet0>
          <Data><![CDATA[<ns0:Cancel xmlns:ns0="http://test.cancel"><FiledHeader>sales</FieldHeader><Body><transactiontype>cancel</Body>]]></Data>
        </TypedPollingResultSet0>
        <TypedPollingResultSet0>
          <Data><![CDATA[<ns0:Cancel xmlns:ns0="http://test.cancel"><FiledHeader>sales</FieldHeader><Body><transactiontype>cancel</Body>]]></Data>
        </TypedPollingResultSet0>
        <TypedPollingResultSet0>
          <Data><![CDATA[<ns0:Cancel xmlns:ns0="http://test.cancel"><FiledHeader>sales</FieldHeader><Body><transactiontype>cancel</Body>]]></Data>
        </TypedPollingResultSet0>
        
      </TypedPollingResultSet0>
    </TypedPolling>


    Friday, August 28, 2015 6:02 AM

All replies

  • HI Booby ,

    Below is the Xpath of the data section . You can trim the resultant to get the CDATA section inside the Data section .

    /*[local-name()='TypedPolling' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test'][1]/*[local-name()='Data' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']

    Thanks

    Abhishek

    Friday, August 28, 2015 6:10 AM
  • Abhishek-can you please elaborate your answer ,below is the format that i am using inside my expression shape.

    I am getting nulll exception

    xmlDoc = xpath(TypedPollingProcRsp, (your xpath))

    Error

    Inner exception: The part 'part' of message 'xmlDoc' contained a null value at the end of the construct block.
            
    Exception type: NullPartException
    Source: Microsoft.XLANGs.Engine
    Target Site: Void ConstructionCompleteEvent(Boolean)
    The following is a stack trace that identifies the location where the exception occured

    Friday, August 28, 2015 6:32 AM
  • HI ,

    You need to pass the path correctly to get the resultant DATA section from your xml

    I am getting below output from the same xpath.

    Result: <ns0:Cancel xmlns:ns0="http://test.cancel"><FiledHeader>sales</FieldHeader><Body><transactiontype>cancel</Body>

    I am using something like below

    strString= xpath(TypedPollingProcRsp, string(string(/*[local-name()='TypedPolling' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test'][2]/*[local-name()='Data' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test'])))

    Thanks

    Abhishek

    Friday, August 28, 2015 6:41 AM
  • Here is my XPATH..do i need to make any changes

    xmlDoc = xpath(TypedPollingProcRsp, "string((/*[local-name()='TypedPolling' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test'][1]/*[local-name()='Data' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test'])");

    Friday, August 28, 2015 6:54 AM
  • Use strString( string variable) not xmldoc .

    Use below code in expression shape.

    strString= xpath(TypedPollingProcRsp, string(string(/*[local-name()='TypedPolling' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test'][2]/*[local-name()='Data' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/Test'])))

    Thanks

    Abhishek

    Friday, August 28, 2015 7:09 AM
  • Thank you very much.It is  working as i expected
    Friday, August 28, 2015 7:37 AM