developers

    Forum Stats

  • 3,873,841 Users
  • 2,266,617 Discussions
  • 7,911,644 Comments

Discussions

Check for CDATA in the input xml

Soumik
Soumik Member Posts: 11 Blue Ribbon
edited Jun 12, 2013 4:08PM in XQuery

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.

Answers

  • odie_63
    odie_63 Member Posts: 8,493 Silver Trophy
    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.

This discussion has been closed.
developers