Re: [configuration] Adding CData to xml property

2015-01-07 Thread jeevi tesh
Hi martin,
Thanks for the helping hand.

I tried with the approach which you said but no fruit.
StringBuffer cDataTagStart= new StringBuffer();
cDataTagStart.append(3C![CDATA[);
cDataTagStart.append(]]3E);

xmlContentOfMetaData.addProperty(Resource.ResourceURL, cDataTagStart);

Still Its adding Special charters
ResourceURL003C![CDATA[]]003E/ResourceURL

Also tried with below approach
cDataTagStart.append(lt;![CDATA[);
cDataTagStart.append(]]gt;);

cDataTagStart.append(003C![CDATA[);
cDataTagStart.append(]]003E);

cDataTagStart.append(\u003C![CDATA[);
cDataTagStart.append(]]\u003E);

None of the above resulted in adding ![[CData Tag

Thanks

On Wed, Jan 7, 2015 at 9:03 PM, Martin Gainty mgai...@hotmail.com wrote:



  Date: Tue, 6 Jan 2015 18:40:07 +0100
  From: oliver.he...@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 are
   getting added. Here is my code. Please give your thoughts on the same.
  
   Here is the code.
  
   String cDataTagStart=\\![CDATA[;
  
   String cDataTagEnd=]]\\;
  
   credentialsURL =cDataTagStart+credentialsURL+cDataTagEnd;
  
   xmlContentOfMetaData = CredentialProvider.*getInstance*();
  
   xmlContentOfMetaData.addProperty(Resource(-1).ResourceName,
 resourceName);
  
   xmlContentOfMetaData.addProperty(Resource.ResourceURL,
 credentialsURL);
  
  
  
   But Special characters are getting added
  
   ResourceNameTESTRESOURCENAME/ResourceName
  
   ResourceURL\![CDATA[TESTCredentialsURLS2]]\/ResourceURL
  
 
  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].

 MGIn the meanwhile why not use StringBuffer to concatenate the Unicode
 equivalent for your CDATA
 MGexample: this prints the Unicode equivalent of the divisor character '÷'
 MGSystem.out.println(\\u +
 Integer.toHexString('÷'|0x1).substring(1) )

  Oliver
 
  [1]
 
 http://commons.apache.org/proper/commons-configuration/issue-tracking.html
 
  
   Thanks
  
   jeevitesh
  
 
  -
  To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
  For additional commands, e-mail: user-h...@commons.apache.org
 




RE: [configuration] Adding CData to xml property

2015-01-07 Thread Martin Gainty


 Date: Tue, 6 Jan 2015 18:40:07 +0100
 From: oliver.he...@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 are
  getting added. Here is my code. Please give your thoughts on the same.
 
  Here is the code.
 
  String cDataTagStart=\\![CDATA[;
 
  String cDataTagEnd=]]\\;
 
  credentialsURL =cDataTagStart+credentialsURL+cDataTagEnd;
 
  xmlContentOfMetaData = CredentialProvider.*getInstance*();
 
  xmlContentOfMetaData.addProperty(Resource(-1).ResourceName, resourceName);
 
  xmlContentOfMetaData.addProperty(Resource.ResourceURL, credentialsURL);
 
 
 
  But Special characters are getting added
 
  ResourceNameTESTRESOURCENAME/ResourceName
 
  ResourceURL\lt;![CDATA[TESTCredentialsURLS2]]\gt;/ResourceURL
 
 
 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].

MGIn the meanwhile why not use StringBuffer to concatenate the Unicode 
equivalent for your CDATA
MGexample: this prints the Unicode equivalent of the divisor character '÷'
MGSystem.out.println(\\u + Integer.toHexString('÷'|0x1).substring(1) ) 

 Oliver
 
 [1] 
 http://commons.apache.org/proper/commons-configuration/issue-tracking.html
 
 
  Thanks
 
  jeevitesh
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org