Regarding CDATA in BizTalk orchestration

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>


August 28th, 2015 2:13am

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

Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 2:21am

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

August 28th, 2015 2:43am

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

Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 2:53am

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'])");

August 28th, 2015 3:05am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics