Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 23
Registered: ‎03-07-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Active X substitute

i m making an app with database managed in XML ..

my xml consist of Email id of peoples
for eg:-
<Users>
<User>
<id>pulkitkkr@gmail.com</id>
</User>
<User>
<id>abc@gmail.com</id>
</User>
<User>
<id>pqr@gmail.com</id>
</User>
</Users>


i want that using javascript on button click I get these mail id one by one in variable
<input onclick="getID();" type="button" value="Get ID">

i used the following code which worked for me in Internet explorer but no in chrome safari or any other browser one of my friend said Chrome wont support ActiveXObject :-


function getID(){


var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false";
xmlDoc.load("abc.xml");
var users=xmlDoc.documentElement;

for (var i=0;i<200;i++)
{
var user = users.childNodes(i);

var a = user.getElementsByTagName("id")[0].text;
alert("Email id:-" + a);
}
}


Please help give me a code for chrome browser ........ i just know that in chrome we use xmlhttprequest My frnd told me please give me the code to read the above XML

BlackBerry Development Advisor
Posts: 43
Registered: ‎01-11-2013
My Device: BlackBerry Z10
My Carrier: Rogers

Re: Active X substitute

Have a look at this Stack Overflow answer http://stackoverflow.com/questions/649614/xml-parsing-of-a-variable-string-in-javascript/8412989#841... It is a good example of cross-browser way of parsing XML strings in JS.

--
Senior Systems Software Developer - Enterprise R&D

@roryboy

1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the like/thumbs up button below the post(s)