Return-Path: X-Original-To: apmail-tuscany-dev-archive@www.apache.org Delivered-To: apmail-tuscany-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D8B43EAB0 for ; Thu, 21 Feb 2013 10:52:23 +0000 (UTC) Received: (qmail 86331 invoked by uid 500); 21 Feb 2013 10:52:23 -0000 Delivered-To: apmail-tuscany-dev-archive@tuscany.apache.org Received: (qmail 85435 invoked by uid 500); 21 Feb 2013 10:52:15 -0000 Mailing-List: contact dev-help@tuscany.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tuscany.apache.org Delivered-To: mailing list dev@tuscany.apache.org Received: (qmail 84838 invoked by uid 99); 21 Feb 2013 10:52:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Feb 2013 10:52:12 +0000 Date: Thu, 21 Feb 2013 10:52:12 +0000 (UTC) From: "Thomas Gentsch (JIRA)" To: dev@tuscany.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (TUSCANY-4075) SDO C++ handling of XML CDATA and escaped chars inconsistent MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Thomas Gentsch created TUSCANY-4075: --------------------------------------- Summary: SDO C++ handling of XML CDATA and escaped chars incon= sistent Key: TUSCANY-4075 URL: https://issues.apache.org/jira/browse/TUSCANY-4075 Project: Tuscany Issue Type: Bug Components: C++ SDO Affects Versions: Cpp-M3 Reporter: Thomas Gentsch we are using both C++ and Java SDO in a project and discovered some misbehavior in the C++ components with XML data converted from/to SDO if the XML contains either escaped chars of CDATA. Java seems to do it mostly right (see below) When looking at the SDO (C++ M3) code and searching on the web (e.g. [1]) it looks as if this topic seemed a bit, well, incomplete in the C++ world. The problem (C++): - loading an XML with CDATA inside works nicely, the CDATA remains=20 intact, therefore saving works nicely too. However, if I do a=20 DataObjectPtr->getCString(), I get the CDATA in the returned value -=20 means as a user I have to deal with that :-| - loading an XML with escaped (e.g. <) works too, libxml2 converts=20 these chars. getCString() returns the real text (e.g. "<"), but=20 saving does not re-insert the escaping - i.e. the resulting XML is=20 not usable anymore (TUSCANY-1553) In Java this looks much better and quite as I'd expect it to: - loading XML with either constructs works - using getCString() just returns the real text with the escaped=20 sections converted - saving works too, CDATA are lost but are rather converted back to=20 escaped XML - this is not the *original* XML anymore but at least it=20 is valid and logically it is the same as the input - Example: Input XML: ü<>bla blub > ]]> getCString() in Java: "=C3=BC<>bla blub <<>> " Saving this as XML: =C3=BC<>bla blub <<>> The only questionable thing is the saved "=C3=BC" ... to be=20 converted back to ü or ü ? Anyway, now the question: As it seems there were discussions going on when SDO C++ has been implemented - has the approach above (as in Java) ever been considered and, if so, why has it not been followed? I believe that this would have been also much simpler than it is today: - while parsing - the cdata handler function of the SAX2 handler just=20 appends the text returned by libxml2 - escaped chars are converted by libxml2 anyway - the property value now contains the real text (e.g. "=C3=BC<>bla blub <<>> ") and returns it just as-is in getCString(= ) - setting that property also just sets the passed-in value - saving the property just calls libxml2 xmlTextWriterWriteString()=20 which should escape the special chars Another advantage is that users don't need to worry about (un)escaping special chars or CDATA as today. Disadvantage: API behavior changes. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira