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: 39
Registered: ‎04-20-2010
My Device: 9000
My Carrier: what is this.

ReferenceError: "ActiveXObject" is not defined - Javascript with blackberry

 

Hi Team, 

Developing an sample rich client application on blackberry using Visual studio plugin, Got the need to load an XML Document and read the tag values

 

var xmlDoc =

new ActiveXObject("Microsoft.XMLDOM");

 

xmlDoc.load('ABC.XML ')

 

so hav to define variable  XMLDOC , which is later used to load the XML file into it.

 

When tested in ordinary desktop internet browser, it worked fine , When tested in blackberry simulator , receiving this run time error :

ReferenceError: "ActiveXObject" is not defined

 

Appreceiate , if you could help us in resolvng the issue or suggest some alternative

 

 GIRI

 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: ReferenceError: "ActiveXObject" is not defined - Javascript with blackberry

Hi GIRI,

 

ActiveX objects are only available inside of Internet Explorer running on Windows. They won't work in any other web browser.  

 

If you are looking to parse XML in your application you can use standards based approaches such as using  XMLHttpRequest to load the document through AJAX.

 

You can also use DOMParser if you are looking to parse a string that you already have loaded into JavaScript

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9000
My Carrier: what is this.

Re: ReferenceError: "ActiveXObject" is not defined - Javascript with blackberry

Thanks for your help Tim. Was able to implement using XMLHttpRequest to read a file but unable to write/update the XML file that I read.

 

Using ActiveXObject I can read and write but using XMLHttpRequest I am unable to. So need your further help to let me know, what are the extra settings/ways do I need to implement in my code to be able to write into an XML file.

 

Appreciate your expedite response.

 

Giridhar

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: ReferenceError: "ActiveXObject" is not defined - Javascript with blackberry

By "write to a file" do you mean manipulate the response returned from the XMLHttpRequest or to physically write data to a remote file?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9000
My Carrier: what is this.

Re: ReferenceError: "ActiveXObject" is not defined - Javascript with blackberry

Thanks for your reply.

I have two requirement -

1) I have an XML file available in my project. to which I need to update fields/add records. The file should retain the changes. (PRIORITY )

2) I need to create an XML file and do the update fields/add records to it.

 

Appreciate if someone can take the priority one, as, I need a solution by evening today.

 

Thanks

Giridhar