18 January 2026:


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 read UTF-8 characters from XML file?

nagarnagar Members
edited March 2012 in Sahi - Open Source
Hi All,

I am trying to read an XML file, which contains UTF-8 characters.
My XML file is:
<Entity>
<Action>
<TC ID="1">
<Obj name="rulename" type="textbox">गूगल</Obj>
<Enable></Enable>
<Disable></Disable>
</TC>
<TC ID="2">
<Obj name="szone" type="listbox">WAN</Obj>
<Enable></Enable>
<Disable></Disable>
</TC>
<TC ID="3">
<Obj name="dzone" type="listbox">WAN</Obj>
<Enable></Enable>
<Disable>4,5,6,7,8,9,10,11,12,13,14</Disable>
</TC>
</Action>
</Entity>
Now when I try to read this XML file and find the length of child nodes <TC>, it returns 0 length.
My sahi code for reading XML is:
$xmlstr = _readFile($filename);
var $x = new XML($xmlstr);
var $ActLen = $x.Action.child("TC").length();
And so, I am not able to proceed further, regarding reading value from TC ID=1.

Kindly help in this issue.

Comments

  • nagarnagar Members
    I am still finding out the solution. If any one can share ideas, it would be highly appreciated.
Sign In or Register to comment.