i got the answer in JQuery list just know
http://malsup.com/jquery/test/d.htmljust like the link above
this code below can run very well on the server environment
but i test it on my local file system(outside the server environment)
it's confusing huh....
---
$(document).ready(function() {
$.get('d.xml',function(data) {
$(data).find('entry').each(function() {
alert('find');
});
});
});
---
sipo
2007/8/7, John Resig <
jeresig@gmail.com>:
>
> That's most likely because IE7 requires specific headers to be
> returned with the XML, in order for it to be properly parsed. This is
> beyond what jQuery can handle, in that this is something that must be
> handled on the server side in order for the browsers to behave
> properly.
>
> --John
>
> On 8/7/07, Sipo <
sipo1209@gmail.com> wrote:
> >
> > by the way,
> > if you tell the ajax return XML
> > then this code can only be executed in firefox2.0 but not IE7
> > ----
> > $(document).ready(function() {
> > $.get("d.xml",null,function(xml){
> > alert($('/controls/control', xml).text());
> > },"xml");
> > });
> > ----
> >
> > 2007/8/7, John Resig <
jeresig@gmail.com>:
> > >
> > > Ah - well there you go - you're serving up the XML file with the
> > > correct mimetype - meaning that no browser will be able to help you
> > > parse it. Unfortunately, jQuery can only be so smart when determining
> > > if something is an XML document or just plain HTML. You'll need to be
> > > sure that the content type is 'text/xml' for this to work.
> > >
> > > --John
> > >
> > > On 8/7/07, Sipo <
sipo1209@gmail.com> wrote:
> > > >
> > > > Hi Karl,
> > > >
> > > > the version I used is
> > > >
http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.1.3.1.js> > > > I have no idea what Packt's site is.
> > > >
> > > > I found out my solution temporarily just now.
> > > > the code is
> > > > d.xml
> > > > ------
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <controls>
> > > > <control>aaaaa</control>
> > > > </controls>
> > > > ------
> > > > d.html
> > > > -------
> > > > <script language="javascript">
> > > > $(document).ready(function() {
> > > > $.get("d.xml",function(xml){
> > > > var xmlDoc=null;
> > > > if ($.browser.msie)
> > > > {
> > > > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
> > > > xmlDoc.loadXML(xml);
> > > > }
> > > > else
> > > > {
> > > > var parser = new DOMParser();
> > > > var xmlDoc= parser.parseFromString(xml, "text/xml");
> > > > }
> > > > //sipo's solution for 1.1.3.1 www.dc9.cn
> > > > alert($('/controls/control', xmlDoc).text());
> > > > });
> > > > });
> > > > </script>
> > > > ---------
> > > > I hope 1.1.4 something will fix this bug.
> > > > ---------
> > > > I will report another bug later and give you my solution
> > > > i will post a new mail.
> > > > the title will be "bug when append a node like <link/> and solution"
> > > > ---------
> > > >
> > > > 2007/8/7, Karl Swedberg <
karl@englishrules.com>:
> > > > > Hi Sipo,
> > > > >
> > > > > So sorry about that! The version of jQuery that was bundled with the code
> > > > > download from Packt's site has a bug that has been fixed in later releases.
> > > > > We're working with Packt to update that code download. In the meantime,
> > > > > please grab the latest build from the jquery.com home page. Again, I'm
> > > > > really sorry about the inconvenience this has caused you.
> > > > >
> > > > >
> > > > > --Karl
> > > > > _________________
> > > > > Karl Swedberg
> > > > > www.englishrules.com
> > > > > www.learningjquery.com
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Aug 7, 2007, at 1:00 AM, Sipo wrote:
> > > > >
> > > > >
> > > > > of course i have.....even a simple xml,jquery cannot parse.
> > > > > i tested about 6 hours
> > > > > but still cannot execute
> > > > > such as
> > > > > -----
> > > > >
> > > > >
> > > > > $(document).ready(function() {
> > > > > $.get('d.xml',function(data) {
> > > > > alert(data);//ok
> > > > > $(data).find('entry').each(function() {
> > > > > alert('find');
> > > > > });
> > > > > });
> > > > > });
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > -----
> > > > >
> > > > > d.xml
> > > > >
> > > > > -----
> > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > <entries>
> > > > > <entry term="DANCE" part="v.i.">
> > > > > <definition>
> > > > > 123
> > > > > </definition>
> > > > > </entry>
> > > > > </entries>
> > > > >
> > > > > --------
> > > > > test it, then you will find the problem...
> > > > > really strange
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 2007/8/7, John Resig <
jeresig@gmail.com>:
> > > > >
> > > > > Of course it can handle XML - do you have the d.xml file in the
> > > > > directory? If it's not there, then nothing will be loaded.
> > > > >
> > > > > --John
> > > > >
> > > > > On 8/6/07, sipo <
sipo1209@gmail.com>