Hi All
I have problem reading the XML basically the CDATA.I have a XML File,for the SQL queries in key value pair.The format is shown as below
<database-queries>
<query name = "some query">
select * from sometable where something <= 1;
</query>
</database-queries>
Now when I use the above xml Iam getting error for "<=" and I got to use the CDATA.My
java code that reads the XML is as below.Iam reading teh XML file and storing them in hashmap as key/value pair.But using CDATA ,Iam getting SQL Exception..Is there any way of loading the queries and using the CDATA as well.
NodeList list = document.getChildNodes();
Node node = list.item(0);
if(node.getNodeName().equals("database-queries"))
{
NodeList nodes = node.getChildNodes();
for(int j = 0; j < nodes.getLength(); j++)
{
Node cnode = nodes.item(j);
if(cnode.getNodeName().equals("query"))
{
NamedNodeMap attrList = cnode.getAttributes();
String queryName = attrList.getNamedItem("name").getNodeValue();
String query = cnode.getFirstChild().getNodeValue();
dbMap.put(queryName, query);
Thanks in advance
Shiv