Re: [xmljs-users] xml and javascript problem.
Brought to you by:
djoham,
witchhunter
From: David J. <dj...@ya...> - 2004-08-02 19:54:19
|
Hi Tun Lin, Since your question doesn't directly relate to XML for <SCRIPT>, I can only guess as to what the problem is. I'm guessing that you're running into a security problem loading the file. Your JavaScript or HTML probably thinks that the file you're trying to load is not from its originating domain when you're connect to localhost. When you're connected via a mount point, it thinks your OK. Why this is, I'm not sure :( The only thing I can think of is to go google for some examples of how this works. You might also want to look at the Sarissa project on SourceForge for some help. The Sarissa project is a wrapper around the various browser's DOM implementations. The URL for the project is https://sourceforge.net/projects/sarissa/ Good luck! David --- Tun Lin <ch...@si...> wrote: > > Hi everyone, > > I am trying xml dom in javascript in html file but I have a problem. This is because when I try > a html with javascript as attached on localhost, it is unable to run properly. However, if I > just double click on the file, it is able to run properly. > > Can anyone help, please? > > Regards, > > Tun Lin. --------------------------------- var arrTags = new Array();var uarrTags = new Array();var strContent = "";var ie = (typeof window.ActiveXObject != 'undefined');var moz = (typeof document.implementation != 'undefined') & (typeof document.implementation.createDocument != 'undefined');var xmlDoc; function importXML(file) { if (moz) { xmlDoc = document.implementation.createDocument("", "doc", null); xmlDoc.onload = readXML; xmlDoc.load(file); } else if (ie) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = false; while(xmlDoc.readyState != 4) {}; xmlDoc.load(file); readXML(); }}function readXML() { root = xmlDoc.documentElement; crawl(root, 0); uarrTags=findUniqueTags(arrTags);for ( var i = 0; i "; //strContent = strContent + indent + "attributes = " + node.attributes + " "; //strContent = strContent + indent + "childNodes = " + node.childNodes + " "; //strContent = strContent + indent + "firstChild = " + node.firstChild + " "; //strContent = strContent + indent + "lastChild = " + node.lastChild + " "; //strContent = strContent + indent + "nextSibling = " + node.nextSibling + " "; //strContent = strContent + indent + "nodeName = " + node.nodeName + " "; strContent = strContent + node.nodeName + " ";var n = node.nodeName;var tokenizer = n.split(":")if(n!="#text"){arrTags.push(tokenizer[1]);} //if(strContent.equals("rdf:RDF")) //{ //strContent = strContent; //}//index++; //arrTags.add(strContent); //document.myform.example.options[0]=strContent; //strContent = strContent + indent + "nodeType = " + node.nodeType + " "; //strContent = strContent + indent + "nodeValue = " + node.nodeValue + " "; //strContent = strContent + indent + "ownerDocument = " + node.ownerDocument + " "; //strContent = strContent + indent + "parentNode = " + node.parentNode + " "; //strContent = strContent + indent + "previousSibling = " + node.previousSibling + " "; if (node.attributes) { if (node.attributes.length > 0) { for (var i = 0; i "; //strContent = strContent + indent + " " + "attribute specified = " + attribute.specified + " "; //strContent = strContent + indent + " " + "attribute value = " + attribute.value + " "; } } } } if (node.firstChild) { crawl(node.firstChild, level + 1); } if (node.nextSibling) { crawl(node.nextSibling, level); } strContent = strContent + " ";}function findUniqueTags(arrAllTags) { var arrUniqueTags = new Array();var tagsPresentCounter = 0; for (i=0; i This is a more "real life" example, powered by a single XQuery script. The sample collection contains 71098 book description (in RDF/XML) taken from our local university library. Search in Search what Interpret as Any Creator,Editor Title Description Subject Creator,Editor Title Description Subject Subject Creator,Editor Title Description [input] near exact match word list or and Any Creator,Editor Title Description Subject Creator,Editor Title Description Subject Subject Creator,Editor Title Description [input] near exact match word list 15 30 50 100 hits will be displayed [input] You may use wildcards *, ? and character ranges like [a-zA-Z] for search terms |