473,597 Members | 2,820 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2963
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.c om/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
authenticati on 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.c om/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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2877
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed loaded into cache, the slideshow doesn't look very nice. I am not sure how/when to call the slideshow() function to make sure it starts after the preload has been completed.
3
12073
by: Hilton Lima | last post by:
Hi there; I have the following problem. I am using one of the many javascript XML parsing scripts available around the Internet, but the parsing fails when it reach an XML child node that is empty, as in the example below: <FirstName>John</FirstName> <MiddleInitial></MiddleInitial> <LastName>Smith</LastName> John Smith does not have a middle initial. When the parsing scripts I tried reach this node, it fails with a message such as...
5
1757
by: Martin Walke | last post by:
Hi all, Can someone help me out here? I'm been using ASP and VBScript for some years but have just ventured into the realms of using server side Javascript and apart from hitting various niggerly problems, this one baffles me. This is a very simplistic example of the problem. <%@ Language="JavaScript"%>
0
2374
by: bruce | last post by:
hi... it appears that i'm running into a possible problem with mechanize/browser/python rgarding the "select_form" method. i've tried the following and get the error listed: br.select_form(nr = 1) br.select_form(name="foo") br.select_form(name=foo) br.select_form(name="foo")
3
1904
by: Rodrigo Meza | last post by:
Hello Everyone For a project I am working on, I need to retrieve links from html documents. The easy part is to obtain 'plain' links like <A HREF="http://site/path/document">, but when those links are javascript'ized, the only robust solution needs to load the javascript and dom document representation in the same way that browsers do. For example, links in the form: <A HREF="javascript:function_declared_before("arguments"));>
6
5920
by: jackwootton | last post by:
Hello everyone, I understand that XML can be parsed using JavaScript using the XML Document object. However, it is possible to parse XHTML using JavaScript? I currently listen for DOMMutation events, when the events occur I access the node which was inserted or removed (event.target). There is only ever about 5 lines of XHTML nested in the node, however it would be silly for me to parse it manually using methods like hasChildNodes...
0
951
by: bruce | last post by:
Hi... I've got a couple of test apps that I use to parse/test different html webpages. However, I'm now looking at how to parse a given site/page that uses javascript calls to dynamically create/display the resulting HTML. I can see the HTML is the Browser page if I manually select the btn that invokes the javascript function, but I have no idea how to create an app that can effectively parse the page.
1
4821
by: avpkills2002 | last post by:
I seem to be getting this weird problem in Internet explorer. I have written a code for parsing a XML file and displaying the output. The code works perfectly fine with ffx(Firefox).However is not working in Internet Explorer.(I m using Internet Explorer 6.0). The code is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
1
2864
by: Philip Semanchuk | last post by:
On Oct 12, 2008, at 5:25 AM, S.Selvam Siva wrote: Selvam, You can try to find them yourself using string parsing, but that's difficult. The closer you want to get to "perfect" at finding URLs expressed in JS, the closer you'll get to rewriting a JS interpreter. For instance, this is not so hard to understand: "http://example.com/" but this is:
16
9280
by: freefony | last post by:
Am trying to parse a php array into javascript but i found that only one element of the array was present in the javascript array. here is my code code <?php include("../../connect.php"); $qry="select * from stock"; $rst=mysql_query($qry) or die("Error in Query.".$qry." ".mysql_error()); while($row=mysql_fetch_assoc($rst)){ $item=$row; $list=$row; }
0
7894
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8284
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8262
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3938
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2410
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.