1 Reply Latest reply: Jun 12, 2013 3:08 PM by odie_63 RSS

    Check for CDATA in the input xml

    Soumik

      We have a requirement where the contents on Input XML can be of two types:

      1.  XML String

      Ex-

      <con:fault xmlns:con="http://www.bea.com/wli/sb/context">

             <con:errorCode>BEA-382500</con:errorCode>

             <con:reason>OSB Service Callout action received SOAP Fault response</con:reason>

             <con:details>

                  <con1:ReceivedFaultDetail xmlns:con1="http://www.bea.com/wli/sb/stages/transform/config">    

                       <con1:faultcode>WebServiceException</con1:faultcode>    

                       <con1:faultstring>

                            <![CDATA[   

                               <Errors>              

                                   <Error/>

                               </Errors>

                           ]]></con1:faultstring>

                     </con1:ReceivedFaultDetail>

                </con:details>

      </con:fault>

       

      2. Normal XML.

      Ex:

      <con:fault xmlns:con="http://www.bea.com/wli/sb/context">

             <con:errorCode>BEA-382500</con:errorCode>

             <con:reason>OSB Service Callout action received SOAP Fault response</con:reason>

             <con:details>

                  <con1:ReceivedFaultDetail xmlns:con1="http://www.bea.com/wli/sb/stages/transform/config">

                       <con1:faultcode xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">generalException</con1:faultcode>

                       <con1:faultstring>Internal Error</con1:faultstring>

                  </con1:ReceivedFaultDetail>

           </con:details>

      </con:fault>

       

      So, just wanted to know if it is possible to check if the Input contains the CDATA tags using XQuery?

      We tried with data($appFault/*:details/*:ReceivedFaultDetail/*:faultstring) and $appFault/*:details/*:ReceivedFaultDetail/*:faultstring/text() but it is removing the CDATA tags from the response.

       

      Thanks.

        • 1. Re: Check for CDATA in the input xml
          odie_63

          Soumik wrote:

           

          So, just wanted to know if it is possible to check if the Input contains the CDATA tags using XQuery?

          I don't think so.

          From the parser point of view, CDATA is not a tag but simply a section of serialized text that has not been escaped. When the document is parsed it'll become an ordinary text node.

           

          You can detect it with DOM or SAX though, but it's out of your scope I supposed.