SDOSAX2Parser inserts "]]><![CDATA[" when parsing XML from string buffer
------------------------------------------------------------------------

                 Key: TUSCANY-3715
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3715
             Project: Tuscany
          Issue Type: Bug
          Components: C++ SDO
    Affects Versions: Cpp-M3
            Reporter: Thomas Gentsch


When parsing a XML doc from a string buffer using XMLHelper::load() the 
resulting string property contains "]]><![CDATA[".
Example:
Original:
====================
<?xml version="1.0" encoding="UTF-8"?>
<tns1:bla xmlns:tns1="http://bla...";>
 <tns1:name>...</tns1:name>
 <tns1:label>...</tns1:label>
 <tns1:description>...</tns1:description>
 <tns1:modeltype>raw</tns1:modeltype>
 <tns1:version>1.0.0</tns1:version>
 <tns1:raw>
<![CDATA[
Whatever stuff containing < and > and this and that ...
...
====================

Results in something like (with the wrong CDATA tags every 300 bytes):
====================
<?xml version="1.0" encoding="UTF-8"?>
<tns1:bla xmlns:tns1="http://bla...";>
 <tns1:name>...</tns1:name>
 <tns1:label>...</tns1:label>
 <tns1:description>...</tns1:description>
 <tns1:modeltype>raw</tns1:modeltype>
 <tns1:version>1.0.0</tns1:version>
 <tns1:raw>
<![CDATA[
Whatever stuff con]]><![CDATA[taining < and > and this an]]><![CDATA[d that ...
...
====================

This does not happen when parsing the same XML from a file.

The problem is in the chunked parsing and then constructing the prop value:
void SDOSAX2Parser::characters(const SDOXMLString& chars)
{
 ...
  if (!currentPropertySetting.name.isNull())
  {
   currentPropertySetting.value = currentPropertySetting.value + chars;
   return;
  }
 ...
}

Here the prop value gets just concatenated but every chunk of "chars" is 
enclosed in <![CDATA[...]]>.

Solution:
Before adding a new chunk, strip "]]>" from currentPropertySetting.value and 
"<![CDATA[" from "chars".


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to