Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5EB3110D4E for ; Thu, 8 Jan 2015 06:01:43 +0000 (UTC) Received: (qmail 6769 invoked by uid 500); 8 Jan 2015 06:01:43 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 6655 invoked by uid 500); 8 Jan 2015 06:01:43 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 6639 invoked by uid 99); 8 Jan 2015 06:01:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jan 2015 06:01:41 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeevitesh.ms@gmail.com designates 209.85.213.170 as permitted sender) Received: from [209.85.213.170] (HELO mail-ig0-f170.google.com) (209.85.213.170) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jan 2015 06:01:37 +0000 Received: by mail-ig0-f170.google.com with SMTP id r2so1218889igi.1 for ; Wed, 07 Jan 2015 22:00:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=VIsn60XTx1lrcNPOxh7dHQKF0p6p3BPGaQLyZfGLmLk=; b=hg2ru9mkVuzWPO+/0wTrkC6YCxPTkQUR5E67+Ro8N60cbDalJG8uBgvKWUyNFxt0Dw 566bluewdZX+lcKcXCdBgca6fAEg3dSj54kBBGr+lCIMrIlNA1GQCZVbZGsmEK0jrWEI KRnrKf4IXT3cpUlmdQGyCzkWm20K2whuNZr2jIiOesX5du7fEZxCZ1M7ZPs8nnd0fGBh xs6YN7CrS95C1D9UKGpomIIolP+ZRSWZV+sNgACf04vjXDm0pUO0J1bThJc2PcrsqC1k e4GL2MWxtl8XDhPwh3jIAOPWm5EukEy/Yu551q7n8ecmoFhUFZ4vRetJXixSnlMvOK4c nZCg== MIME-Version: 1.0 X-Received: by 10.50.118.97 with SMTP id kl1mr7941177igb.23.1420696828272; Wed, 07 Jan 2015 22:00:28 -0800 (PST) Received: by 10.107.168.32 with HTTP; Wed, 7 Jan 2015 22:00:28 -0800 (PST) In-Reply-To: References: <54AC1DF7.4080704@oliver-heger.de> Date: Thu, 8 Jan 2015 11:30:28 +0530 Message-ID: Subject: Re: [configuration] Adding CData to xml property From: jeevi tesh To: Commons Users List Content-Type: multipart/alternative; boundary=089e013a1118c87617050c1dc1d9 X-Virus-Checked: Checked by ClamAV on apache.org --089e013a1118c87617050c1dc1d9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi martin, Thanks for the helping hand. I tried with the approach which you said but no fruit. StringBuffer cDataTagStart=3D new StringBuffer(); cDataTagStart.append("3C![CDATA["); cDataTagStart.append("]]3E"); xmlContentOfMetaData.addProperty("Resource.ResourceURL", cDataTagStart); Still Its adding Special charters 003C![CDATA[]]003E Also tried with below approach cDataTagStart.append("<![CDATA["); cDataTagStart.append("]]>"); cDataTagStart.append("003C![CDATA["); cDataTagStart.append("]]003E"); cDataTagStart.append("\u003C![CDATA["); cDataTagStart.append("]]\u003E"); None of the above resulted in adding Tag Thanks On Wed, Jan 7, 2015 at 9:03 PM, Martin Gainty wrote: > > > > Date: Tue, 6 Jan 2015 18:40:07 +0100 > > From: oliver.heger@oliver-heger.de > > To: user@commons.apache.org > > Subject: Re: [configuration] Adding CData to xml property > > > > > > > > On 06.01.2015 17:55, jeevi tesh wrote: > > > Hi, > > > > > > Need to add CDATA into XML Property element, but special character ar= e > > > getting added. Here is my code. Please give your thoughts on the same= . > > > > > > Here is the code. > > > > > > String cDataTagStart=3D"\\ > > > > > String cDataTagEnd=3D"]]\\>"; > > > > > > credentialsURL =3DcDataTagStart+credentialsURL+cDataTagEnd; > > > > > > xmlContentOfMetaData =3D CredentialProvider.*getInstance*(); > > > > > > xmlContentOfMetaData.addProperty("Resource(-1).ResourceName", > resourceName); > > > > > > xmlContentOfMetaData.addProperty("Resource.ResourceURL", > credentialsURL); > > > > > > > > > > > > But Special characters are getting added > > > > > > ResourceName>TESTRESOURCENAME > > > > > > \ > > > > > > > XMLConfiguration ensures that for newly added or updated properties > > valid XML is generated. Therefore, special characters are encoded > > automatically. This frees applications from the burden to do the > > encoding manually. However, there is less control of the XML generated. > > > > Currently, XMLConfiguration does not supported the generation of CDATA > > sections. You may want to add a feature request in our bug tracking > > system [1]. > > MG>In the meanwhile why not use StringBuffer to concatenate the Unicode > equivalent for your CDATA > MG>example: this prints the Unicode equivalent of the divisor character '= =C3=B7' > MG>System.out.println("\\u" + > Integer.toHexString('=C3=B7'|0x10000).substring(1) )> > > > Oliver > > > > [1] > > > http://commons.apache.org/proper/commons-configuration/issue-tracking.htm= l > > > > > > > > Thanks > > > > > > jeevitesh > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > > For additional commands, e-mail: user-help@commons.apache.org > > > > --089e013a1118c87617050c1dc1d9--