You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jarry Liu <ja...@gmail.com> on 2005/06/09 16:48:43 UTC

questions about loading xml file

Hi all,

I try to use javascript to load xml file. Followings are part of the
code.  (got them from http://www.quirksmode.org/dom/importxml.html). 
I am using Mac, so it can pop out "1" "2" "5". But "6" never shows up.
 Anbody can help me to figure out why I can't load the xml file? Thank
a lot.

Jarry

 

  <head>			 
     <script type="text/javascript">	 
			 
     function showkey()
     {       
        if (document.implementation &amp;&amp;
document.implementation.createDocument)
        {
           alert("1");
           xmldoc = document.implementation.createDocument("", "", null);
           alert("2");
        }
        else if (window.ActiveXObject)
        {
           alert("3");
           xmldoc = new ActiveXObject("Microsoft.XMLDOM");       
        }
        else{     
            alert('Your browser can\'t handle this script');
            return;
        }
        
        alert("5"); 
        xmldoc.load("keywords.xml");
               
        alert("6");

        var x = xmldoc.getElementsByTagName("keyword");
        document.show.memm.value= x;             
      }
      </script>
  </head>

  <body>
      <form name="show" onsubmit="return showkey()">         
           <input name="memm" value=""/>
            <input type="submit" value="display" />
      </form>
  </body>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: questions about loading xml file

Posted by Jarry Liu <ja...@gmail.com>.
Lars, Thanks for reply. 

Finally I found the prolbem. Different browser deals with javascript
in different way, it seems that Safari dosn't support the function of 
load(file). Finally I solved that problem by writing a java class and
used in xsp file.


 


On 6/9/05, Lars Huttar <la...@sil.org> wrote:
> Jarry Liu wrote:
> 
> >Hi all,
> >
> >I try to use javascript to load xml file. Followings are part of the
> >code.  (got them from http://www.quirksmode.org/dom/importxml.html).
> >I am using Mac, so it can pop out "1" "2" "5". But "6" never shows up.
> > Anbody can help me to figure out why I can't load the xml file? Thank
> >a lot.
> >
> >Jarry
> >
> >
> >
> You might get more help with this question on a Javascript mailing list.
> It doesn't seem to have much to do with Cocoon.
> Lars
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: questions about loading xml file

Posted by Lars Huttar <la...@sil.org>.
Jarry Liu wrote:

>Hi all,
>
>I try to use javascript to load xml file. Followings are part of the
>code.  (got them from http://www.quirksmode.org/dom/importxml.html). 
>I am using Mac, so it can pop out "1" "2" "5". But "6" never shows up.
> Anbody can help me to figure out why I can't load the xml file? Thank
>a lot.
>
>Jarry
>
>  
>
You might get more help with this question on a Javascript mailing list. 
It doesn't seem to have much to do with Cocoon.
Lars


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org