Re: Adding CData to xml property

2015-01-06 Thread Tim Cronin
it seems like your fighting with the API.

it will escape special chars for you.



On Tue, Jan 6, 2015 at 10:55 AM, jeevi tesh jeevitesh...@gmail.com 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


 Thanks

 jeevitesh



Re: [configuration] Adding CData to xml property

2015-01-06 Thread Oliver Heger



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].


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