commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeevi tesh <jeevitesh...@gmail.com>
Subject Adding New property
Date Fri, 02 Jan 2015 18:50:49 GMT
Hi,
I need to add a new property facing lots of issue suggestion required.
Here is my XML format
<?xml version="1.0" encoding="UTF-8"?>
<Resources>
 <Resource>
  <ResourceName>blackwoods</ResourceName>
  <ResourceURL><![CDATA[WWW.blackwoods.com]]></ResourceURL>
 </Resource>


 <Resource>
  <ResourceName>ordermax</ResourceName>
  <ResourceURL><![CDATA[http://www.ordermax.com]]></ResourceURL>
 </Resource>
</Resources>

I need to add new property like
 <Resource>
  <ResourceName>dell</ResourceName>
  <ResourceURL><![CDATA[http://www.dell.com]]></ResourceURL>
 </Resource>
i Have tried like
1. addProperty("Resource.ResourceName") -> issue with this approach is it
add within last element like
 <Resource>
  <ResourceName>ordermax</ResourceName>
  <ResourceURL><![CDATA[http://www.ordermax.com]]></ResourceURL>
<ResourceName>dell</ResourceName>
  <ResourceURL><![CDATA[http://www.dell.com]]></ResourceURL>
 </Resource>

2. used setProperty("Resource.ResourceName") -> deletes all the existing
property. so tried to read all items in xml and then use setproperty when i
use save it saves only last elements.
String temp2=+dell+"\n"+"\n<ResourceURL>"+www.dell.com+"\n</ResourceURL>";
3. used addProperty("Resource"temp2);
But this approach is adding special charters like below
<Resource>&lt;ResourceName&gt;del&lt;/ResourceName&gt;&lt;ResourceURL&gt;
www.dell.com&lt;/ResourceURL&gt;</Resource>
Please help me to resolve the same
Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message