Nested CDATA problem

All content will be within the CDATA are ignored by the parser. In a CDATA section "<! [CDATA [" Start flag to "]]>" marks the end. But CDATA is not capable of nesting.

Because CDATA nested XML parsing error caused the problem, refer to the online approach, only need to solve this problem. " ]]> " Replaced " ]]]]> <! [CDATA [> ", after replacing the text as a parameter CDATA incoming, identifying a plurality of original CDATA CDATA, return automatically after connection.

Similarly nested, i.e. split multistage connection.

 

Such as

<![CDATA[

<Request>

<BankTradeInfo>

<![CDATA[

<Response><TradeCode>4200</TradeCode></Response>

]]>

</BankTradeInfo>

</Request>

]]> 

CDATA CDATA nested inside need, looked at the statistics, the solution is the second major CDATA inside the "]]>" is replaced by "]]]]> <! [CDATA [>"

which is:

<![CDATA[

<Request>

<BankTradeInfo>

<![CDATA[

<Response><TradeCode>4200</TradeCode></Response>

]]]]><![CDATA[>

</BankTradeInfo>

</Request>

]]> 

Guess you like

Origin www.cnblogs.com/Violety/p/11847853.html