Leena

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromLeena
ToMe
SubjectCannot get the data from XML file after refreshing HTML page
Date4 January 2006 10:16
AttachmentDemonstration of the problem
Sir,
      I am using JavaScript to parse my XML file after parsing I am displaying it in HTML table.
I have hosted the HTML page on my IIS Server , The first time u browsed the page on the client browser the data comes immediately after the page is refreshed all the parsed data gets vanished

I have attached the xml file & the html file 

Kindly tell me what i can do for this

Regards
Leena
FromMe
ToLeena
SubjectRe: Cannot get the data from XML file after refreshing HTML page
Date4 January 2006 10:35
Leena,

> The first time u browsed the page on the client browser the
> data comes immediately after the page is refreshed all the parsed
> data gets vanished

At a guess, this is something to do with caching in IE's proprietary data
islands. Since I refuse to use IE specific techniques (except to fix IE
bugs), I have not investigated what might cause this. I recommend you use
normal XML importing instead. Not only will that fix your problem, it will
also work in the other browsers as well.

http://www.howtocreate.co.uk/tutorials/jsexamples/importingXML.html


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromLeena
ToMe
SubjectRe: Cannot get the data from XML file after refreshing HTML page
Date4 January 2006 12:34
Thanks that was really a very fast reply

Sir,

In the XML Importing Script  u asked to call the function like this

var canItWork = importXML( 'myXML.xml', 'runThis' );



where  myXML.xml  will replace my caster.xml

what about 'runthis'  parameter i am not able to get what to specify for
this parameter

Thanking You

Leena
FromMe
ToLeena
SubjectRe: Cannot get the data from XML file after refreshing HTML page
Date4 January 2006 12:47
Leena,

> var canItWork = importXML( 'myXML.xml', 'runThis' );
>
> what about 'runthis'  parameter i am not able to get what to specify for
> this parameter

it should be the name of a function you want it to run when the xml is
loaded. the function will be passed the document object for the XML
document.
FromLeena
ToMe
SubjectHow & where to use the function called in the importXML function
Date5 January 2006 04:45
Sir,

Let me understand step by  step from u .
caster.xml
converter.xml
importxml.js
ops_mail.htm
All are in the same folder 

According to u [Ed. "you"]
I have called in the head 
<HTML>
<head>
<script type="text/javascript"><!--
//for older browsers like Netscape 4 ... if you care
window.onerror = function () { return true; }
//-->
</script>
<script src="importxml.js" type="text/javascript">
var canItWork = importXML( 'caster.xml', 'getChildren' );
<SCRIPT>
</head>

Now My getChildren function takes one argument  that was the island id  this was how i wrote before applying ur method
Now after using ur method how?. should the function body come in the same script tag where we have called the importXML function

//create a document object and a node list
var myDoc=island9;       ////  HOW TO INCORPORATE THIS?

x=getchildren(myDoc);         ////  HOW TO INCORPORATE THIS   ?

//================begin recursive function 'getchildren'==========================
function getchildren(node)        ///    HOW  & where TO define this?
{
//create a child list
var x=node.childNodes; //Contains a list of the child nodes appearing immediately
var z=x.length; 
if(z!=0 )
{
for(var i=0;i<z;i++)
{
if(x(i).nodeType==3) //Contains the XML DOM node type 3= NODE_TEXT 
{ 
document.write("<b><center><FONT SIZE=2 color=white>")
document.write('JVSL-ONLINE STATUS AS ON '+x(i).nodeValue); //Contains the text content of the node
document.write("</FONT></center></b>")
getchildren(x(i));
}
else if(x(i).nodeType==1 && x(i).nodeName==root.nodeName) //Contains the qualified name of the node
{ 
document.write(" <TABLE BORDER=0 WIDTH=100% ALIGN='center' cellpadding=0 cellspacing=0 style='border-collapse: collapse' bordercolor='#111111'> ")
getchildren(x(i));
document.write(" </TABLE> ")
}
else if(x(i).nodeType==1 && x(i).nodeName==fchild.nodeName )
{
document.write(" <TR> ")
getchildren(x(i));
document.write(" </TR> ")
}
else if(x(i).nodeType==1)
{
document.write(" <TD HEIGHT=1> ")
getchildren(x(i));
document.write(" </TD> ")
}
else
{
getchildren(x(i));
}
}
}
}
//==========end function 'getchildren'===================
</SCRIPT> 

Sir,  can u just send one small example file so i will be more clear.

[Ed. See the demonstration page linked in the earlier email.]

Sorry for troubling u again & again
Thanks again
FromLeena
ToMe
SubjectRe: Cannot get the data from XML file after refreshing HTML page
Date6 January 2006 12:40
Sir,
    I have got the solution to my problem . I had not much to do .
In <XML> Tag my src attribute needed to be given the
computername/sharedfolder/filename.xml path .
Then in my IE I had to change in the security tab -- local intranet --
custom level -- miscellaneous -- Access Data sources across domains --
enable
And That started working

Thanks for help from ur side

Keep updated me with new usages...........all right sir


Regards
Leena


[Ed. ARGH! breaking stuff for other browsers. Some people really do not get
it. I certainly hope none of this rubbish code is ever allowed to pollute
the Web.]
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.