I have XML stored in the variable 'ad' and 'addd'.
Variable 'ad':
<?xml version="1.0" encoding="UTF-8"?>
<name>
<data>
<Id>003</Id>
</data>
<data>
<Id>006</Id>
</data>
....
</name>
And Variable 'addd':
<?xml version="1.0" encoding="UTF-8"?>
<name>
<data>
<Id>009</Id>
</data>
<data>
<Id>005</Id>
</data>
...
</name>
I have written a ttt
function:
function ttt(ad,addd) {
var match = ad.match(/<Id\/>/);
var matcht = addd.match(/<Id\/>/);
if ((! match || match.length == 0) && (! matcht || matcht.length == 0)){
return "Below is the details of the Id of ad:\n\n" + ad.split("<Id>")[1].split("</Id>")[0]; + "\n\n And, Below is the details of the Id of addd:\n\n" +addd.split("<Id>")[1].split("</Id>")[0];
}
}
I need If
Id
is not blank from 'ad' variable then return alert as error
with Id
as below:
<?xml version="1.0" encoding="UTF-8"?>
<name>
<data>
<Id>003</Id>
</data>
<data>
<Id>006</Id>
</data>
</name>
And, I need If
Id
is not blank from 'addd' variable then return alert as error
with Id
as below:
<?xml version="1.0" encoding="UTF-8"?>
<name>
<data>
<Id>009</Id>
</data>
<data>
<Id>005</Id>
</data>
</name>