Loading ...
Sorry, an error occurred while loading the content.

Re: Problem with responseXML.documentElement on IE.

Expand Messages
  • andresm1981
    Are you setting the content type correctly? Check this: http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_r.html .. From the link above:
    Message 1 of 8 , Apr 3, 2007
    • 0 Attachment
      Are you setting the content type correctly?

      Check this:
      http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_r.html

      .. From the link above:

      "responseXML is only available if the server sends back an XML
      document with MIME type text/xml, and not if it sends back, for
      instance, an HTML document."

      --- In ydn-javascript@yahoogroups.com, "---" <odiel@...> wrote:
      >
      > Hi, I are new here.
      >
      > Working with some features of YUI I found a problem.
      >
      > I want to process a XML generated by php, some one like this.
      >
      > <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
      > <applications>
      > <all>
      > <name>All programs</name>
      > <link>all_programs</link>
      > <name>Recent programs</name>
      > <link>recent_programs</link>
      > <name>Recent Documents</name>
      > <link>recent_documents</link>
      > <name>Opened</name>
      >
      > <link>opened</link>
      > </all>
      > </applications>
      >
      >
      > when I do it:
      >
      >
      > function successHandler(o){
      > var root = o.responseXML.documentElement;
      > var appName = root.getElementsByTagName('name');
      >
      > alert(appName);
      > }
      >
      >
      > The messages on Opera and Mozilla show [object HTMLColletcion], thats
      > right, but on IE 6.0 the message show NULL.
      >
      > Any idea to make it work??
      >
      > Really thanks.
      >
    • plamen_gurov
      I have similar problems in both IE and FireFox after several hours research I opted for responseText and RegExp parsing.
      Message 2 of 8 , Nov 24, 2007
      • 0 Attachment
        I have similar problems in both IE and FireFox after several hours
        research I opted for responseText and RegExp parsing.

        --- In ydn-javascript@yahoogroups.com, "---" <odiel@...> wrote:
        >
        > Hi, I are new here.
        >
        > Working with some features of YUI I found a problem.
        >
        > I want to process a XML generated by php, some one like this.
        >
        > <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
        > <applications>
        > <all>
        > <name>All programs</name>
        > <link>all_programs</link>
        > <name>Recent programs</name>
        > <link>recent_programs</link>
        > <name>Recent Documents</name>
        > <link>recent_documents</link>
        > <name>Opened</name>
        >
        > <link>opened</link>
        > </all>
        > </applications>
        >
        >
        > when I do it:
        >
        >
        > function successHandler(o){
        > var root = o.responseXML.documentElement;
        > var appName = root.getElementsByTagName('name');
        >
        > alert(appName);
        > }
        >
        >
        > The messages on Opera and Mozilla show [object HTMLColletcion], thats
        > right, but on IE 6.0 the message show NULL.
        >
        > Any idea to make it work??
        >
        > Really thanks.
        >
      • tssha
        ... You shouldn t have to do this. Have a look at: http://developer.yahoo.com/yui/examples/connection/weather.html to see the desired functionality in action.
        Message 3 of 8 , Nov 26, 2007
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "plamen_gurov"
          <plamen_gurov@...> wrote:
          >
          > I have similar problems in both IE and FireFox after several hours
          > research I opted for responseText and RegExp parsing.

          You shouldn't have to do this. Have a look at:
          http://developer.yahoo.com/yui/examples/connection/weather.html to see
          the desired functionality in action. How does your implementation
          differ from this example?

          Regards,
          Thomas
        • plamen_gurov
          ... see ... This does not have much info in it. Here is the responseText (the whole string is one line save for the first r n that got there for unknown
          Message 4 of 8 , Nov 26, 2007
          • 0 Attachment
            --- In ydn-javascript@yahoogroups.com, "tssha" <tsha@...> wrote:
            >
            > --- In ydn-javascript@yahoogroups.com, "plamen_gurov"
            > <plamen_gurov@> wrote:
            > >
            > > I have similar problems in both IE and FireFox after several hours
            > > research I opted for responseText and RegExp parsing.
            >
            > You shouldn't have to do this. Have a look at:
            > http://developer.yahoo.com/yui/examples/connection/weather.html to
            see
            > the desired functionality in action. How does your implementation
            > differ from this example?
            >
            > Regards,
            > Thomas
            >

            This does not have much info in it. Here is the responseText (the
            whole string is one line save for the first \r\n that got there for
            unknown reason): "\r\n<?
            xml version=\"1.0\" standalone=\"yes\" ?
            ><suggestions><word>god</word><word>goad</word><word>good</word><word>
            cod</word><word>gad</word><word>got</word><word>gods</word><word>go</w
            ord><word>gold</word><word>pod</word></suggestions>"
            And I am using the same server approach that we uses successfully for
            a home-grown multi-browser AJAX soluition.
            I tried both with Content-Type "text/xml" and "application/xml".
            BTW, the server side is JBoss and a JSP is actually returning the XML.
            But parsing with RegExp isreally fast...
          • plamen_gurov
            The one thing I haven t tried is to replace the inside the XML to
            Message 5 of 8 , Nov 26, 2007
            • 0 Attachment
              The one thing I haven't tried is to replace the \" inside the XML to '
            • plamen_gurov
              Actually the problem turned out to be the CR NL characters in the begining of the string. The parser requires the response to start with
              Message 6 of 8 , Nov 26, 2007
              • 0 Attachment
                Actually the problem turned out to be the CR NL characters in the
                begining of the string. The parser requires the response to start with
                <?xml ....

                Sorry...
              Your message has been successfully submitted and would be delivered to recipients shortly.