469,325 Members | 1,578 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,325 developers. It's quick & easy.

XML parsing with Javascript

HI THERE,

I have a strange problem. I am writing a firefox extension to the
Onlywire API (http://onlywire.com/index?api). Now the problem is when
I tag pages using the onlywire API the service responds with an xml
that indicates whether the web page was tagged successfully.
Something like this:

<?xml version="1.0"?>
<result code="success" />

Now using the api requires http authentication. After the
authentication succeeds the service responds with an xml file. Now,
the problem is that I dont want the users to see this xml file, I want
to somehow parse the xml file that I receive and display appropriate
message in a popup box.

Any help would be just great. Thanks.

Cheers.

Aug 17 '07 #1
7 2799
ArdGre wrote:
Now using the api requires http authentication. After the
authentication succeeds the service responds with an xml file. Now,
the problem is that I dont want the users to see this xml file, I want
to somehow parse the xml file that I receive and display appropriate
message in a popup box.
You can use XMLHttpRequest
<http://www.xulplanet.com/references/objref/XMLHttpRequest.htmlto make
the request, the open method takes username and password as optional
parameters and you can use the responseXML object to access the XML sent
as the response.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 17 '07 #2
Martin Honnen wrote:
ArdGre wrote:
>Now using the api requires http authentication. After the
authentication succeeds the service responds with an xml file. Now,
the problem is that I dont want the users to see this xml file, I want
to somehow parse the xml file that I receive and display appropriate
message in a popup box.

You can use XMLHttpRequest
<http://www.xulplanet.com/references/objref/XMLHttpRequest.htmlto make
the request, the open method takes username and password as optional
parameters and you can use the responseXML object to access the XML sent
as the response.
If I understand correctly, I don't think XMLHttpRequest is suitable
here, because it looks like the submission is always done to www.onlywire.com
(another domain).

Since the sandbox model doesn't allow access to this XML response, I
think the only possibility is to perform the request from a server
script. And then parse the response at server before returning output
to client.

--
Bart

Aug 17 '07 #3
Bart Van der Donck wrote:
If I understand correctly, I don't think XMLHttpRequest is suitable
here, because it looks like the submission is always done to www.onlywire.com
(another domain).
The original poster is writing a Firefox extension and not some script
in a web page.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 17 '07 #4
Martin Honnen wrote:
Bart Van der Donck wrote:
>If I understand correctly, I don't think XMLHttpRequest is suitable
here, because it looks like the submission is always done towww.onlywire.com
(another domain).

The original poster is writing a Firefox extension and not some script
in a web page.
I don't have any experience in those, but wouldn't XMLHttpRequest need
to go to the other domain anyhow (namely, to onlywire.com) ? Or is it
possible to grab URL's from remote servers with XMLHttpRequest in
Firefox extensions ?

--
Bart

Aug 17 '07 #5
Bart Van der Donck wrote:
Martin Honnen wrote:
>Bart Van der Donck wrote:
>>If I understand correctly, I don't think XMLHttpRequest is suitable
here, because it looks like the submission is always done towww.onlywire.com
(another domain).
The original poster is writing a Firefox extension and not some script
in a web page.

I don't have any experience in those, but wouldn't XMLHttpRequest need
to go to the other domain anyhow (namely, to onlywire.com) ? Or is it
possible to grab URL's from remote servers with XMLHttpRequest in
Firefox extensions ?
I know of no restrictions for Firefox/Gecko extensions. There is even a
Firefox extension written in JavaScript that can display the IP address of
the accessed and the accessing host through XPCOM, among other things. [1]
It is very likely that the Same Origin Policy does not apply here.
PointedEars
___________
[1] https://addons.mozilla.org/de/firefox/addon/590
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Aug 17 '07 #6
Thomas 'PointedEars' Lahn wrote:
Bart Van der Donck wrote:
>Is it possible to grab URL's from remote servers with XMLHttpRequest
in Firefox extensions ?

I know of no restrictions for Firefox/Gecko extensions. [...]
It is very likely that the Same Origin Policy does not apply here.
I would be surprised. Care to backup this claim ?

--
Bart

Aug 17 '07 #7
Bart Van der Donck wrote:
Thomas 'PointedEars' Lahn wrote:
>Bart Van der Donck wrote:
>>Is it possible to grab URL's from remote servers with XMLHttpRequest
in Firefox extensions ?
I know of no restrictions for Firefox/Gecko extensions. [...]
It is very likely that the Same Origin Policy does not apply here.

I would be surprised.
Have I not just proved that extensions can do more than the average
client-side Web script?
Care to backup this claim ?
I have not claimed anything, so I have nothing to back up.
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Aug 17 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Terry | last post: by
5 posts views Thread by Martin Walke | last post: by
reply views Thread by bruce | last post: by
3 posts views Thread by Rodrigo Meza | last post: by
6 posts views Thread by jackwootton | last post: by
1 post views Thread by avpkills2002 | last post: by
1 post views Thread by Philip Semanchuk | last post: by
16 posts views Thread by freefony | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.