473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Parsing XML on different server

4
I have an html document and an XSLT currently. The XML that I need to parse is on a different remote server. Now, the XSLT works without issue as does the HTML document with XMLDOM if the XML file is hosted on the same server, however, when I try to call a remote file it doesnt work. Here is my HTML code with JS:

Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script>
  3. function getQueryVariable(variable) {
  4.   var query = window.location.search.substring(1);
  5.   var vars = query.split("&");
  6.   for (var i=0;i<vars.length;i++) {
  7.     var pair = vars[i].split("=");
  8.     if (pair[0] == variable) {
  9.       return pair[1];
  10.     }
  11.   } 
  12.   alert('Query Variable ' + variable + ' not found');
  13. }
  14. </script>
  15. </head>
  16. <html>
  17. <body>
  18. <script type="text/javascript">
  19.     var1 = getQueryVariable("var1");
  20.     var2 = getQueryVariable("var2");
  21.     vURL = 'http://xml.mywebserver.com/Userid=' + var1 + '&Password=' + var2;
  22. </script>
  23.  
  24. <script type="text/javascript">
  25.        var processor = new XSLTProcessor(); 
  26.             var xslt = document.implementation.createDocument("", "", null); 
  27.             xslt.async = false; 
  28.             xslt.load("transform.xsl"); 
  29.             processor.importStylesheet(xslt); 
  30.  
  31.             var src_doc = document.implementation.createDocument("","", null); 
  32.             src_doc.async = false; 
  33.             src_doc.load("http://xml.mywebserver.com"); 
  34.             var result = processor.transformToDocument(src_doc); 
  35.             var xmls = new XMLSerializer(); 
  36.             var output = xmls.serializeToString(result); 
  37.             document.write(output); 
  38.         } 
  39. </script>
  40. </body>
  41. </html>
  42.  
Really, I need to use my variable vURL as the source document for the XML data as I need the variables passed through the URL. I tried using src_doc.load(vURL) as well but still no go.
Feb 29 '08 #1
2 1360
doby48
4
I guess I should say that for the record I am aware of the issue with javascript not working with cross domain functionality. However, I am know there are several work arounds for this (one be iframes which isnt an option in this case). And am wondering if someone can offer a solution as to a workaround or maybe 2-part solution, this being the second part just looking for maybe a GET functionality or something of the like or other workarounds people are familiar with.
Feb 29 '08 #2
rnd me
427 Expert 256MB
there's (potentially) a few ways to do it without server-side scripting.
i could likely be able to help if i knew a little more, i have a few ideas.


can you control the content on both domains?

can you place a whole file anywhere on the remote domain's server?

what type of xml is it?

does this need to work for just you, or do you need it to work for everyone?
Feb 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
by: Peter Sprenger | last post by:
Hello, I hope somebody can help me with my problem. I am writing Zope python scripts that will do parsing on text for dynamic webpages: I am getting a text from an oracle database that contains...
9
by: RiGGa | last post by:
Hi, I want to parse a web page in Python and have it write certain values out to a mysql database. I really dont know where to start with parsing the html code ( I can work out the database...
9
by: Thomas W | last post by:
I'm developing a web-application where the user sometimes has to enter dates in plain text, allthough a format may be provided to give clues. On the server side this piece of text has to be parsed...
11
by: Sven Neuberg | last post by:
Hi, I have been handed the task of updating and maintaining a web application, written in ASP and Javascript, that takes complex user inputs in HTML form and submits them to server-side ASP...
5
by: randy | last post by:
Can some point me to a good example of parsing XML using C# 2.0? Thanks
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
0
by: savj14 | last post by:
I have been driving myself crazy the past few days trying to figure this out. I have tried different Parsing Scripts and have read and searched various things trying to find a solution. I am...
3
by: anush | last post by:
I have a log file like this: 2008-07-24 17:20:33 W server: shutting down server 2008-07-24 17:20:33 W client: shutting down client I need to parse this using php. I have split them by...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.