18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
How to use default xml ="" for multiple namespace in the xml.
Dear Sir,
I have two doubts,
1. Reading from xml file fails to parse the xml file.
Mycode is as follows,
function parseCommissionXml(){
var $xmlStr = _readFile("D:\\Program Files\\Sahi\\userdata\\scripts\\Step 1\\person.xml");
var $x = new XML($xmlStr);
_assertEqual("Ant", $x.person[0].name.toString()); //ERROR TypeError: Cannot read property "name" from undefined at Feb 8, 2013 7:54:45 PM
//I also tried this $x.person[0].toString().name.toString()
_assertEqual("Grey", $x.person[1].eyes.toString());
}
parseCommissionXml();
2.How to use default xml ="" for multiple namespace in the xml.
I have a file with multiple namespaces, for example
<?xml version="1.0" encoding="UTF-8"?>
<xx3:xxx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xx1="http://xmlns.xxxxxxx.com/1.4.1" xmlns:xx2="http://xmlns.xxxxxxx.com/somediff/1.4.1"
xmlns:xx3="http://xmlns.xxxxxxx.com/somedif/1.4.1"
xsi:schemaLocation="http://xmlns.xxxxxxx.com/somedir/1.4.1 some.xsd">
<!-- Some nodes are skipped. -->
</xx3:xxx>
For the above one, how can I use the default xml namespace =""; to have all the namespaces available in the file....?
Thanks
Bosco
I have two doubts,
1. Reading from xml file fails to parse the xml file.
Mycode is as follows,
function parseCommissionXml(){
var $xmlStr = _readFile("D:\\Program Files\\Sahi\\userdata\\scripts\\Step 1\\person.xml");
var $x = new XML($xmlStr);
_assertEqual("Ant", $x.person[0].name.toString()); //ERROR TypeError: Cannot read property "name" from undefined at Feb 8, 2013 7:54:45 PM
//I also tried this $x.person[0].toString().name.toString()
_assertEqual("Grey", $x.person[1].eyes.toString());
}
parseCommissionXml();
2.How to use default xml ="" for multiple namespace in the xml.
I have a file with multiple namespaces, for example
<?xml version="1.0" encoding="UTF-8"?>
<xx3:xxx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xx1="http://xmlns.xxxxxxx.com/1.4.1" xmlns:xx2="http://xmlns.xxxxxxx.com/somediff/1.4.1"
xmlns:xx3="http://xmlns.xxxxxxx.com/somedif/1.4.1"
xsi:schemaLocation="http://xmlns.xxxxxxx.com/somedir/1.4.1 some.xsd">
<!-- Some nodes are skipped. -->
</xx3:xxx>
For the above one, how can I use the default xml namespace =""; to have all the namespaces available in the file....?
Thanks
Bosco