Parsing XML with namespaces in IE.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    Parsing XML with namespaces in IE.

    With the help of this newsgroup and Google I have got this code
    working fully in Firefox and can alert the XML in IE but because IE
    does not impliment the DOM "getElementsByT agNameNS()" function I
    cannot read the individual rates from the Cube namespace.

    Is there a wrapper or some other relatively simple method of getting
    IE to do what in Firefox is straighforward?

    Here is the code. Any help gratefully received.

    var doc
    function load() {
    if (document.imple mentation &&
    document.implem entation.create Document){
    doc = document.implem entation.create Document("", "", null);
    doc.load('CEBra tes.xml');
    doc.onload = createTable;
    }
    else if (window.ActiveX Object){
    var doc1 = new ActiveXObject(" Microsoft.XMLDO M");
    function loadXML(xmlFile ){
    doc1.async="fal se";
    doc1.onreadysta techange=verify ;
    doc1.load(xmlFi le);
    doc=doc1.docume ntElement;
    }
    loadXML('CEBrat es.xml');
    alert(doc.xml)
    }
    else {
    alert('Your browser can\'t handle this script');
    return;
    }
    }
    function verify() {
    if (doc1.readyStat e != 4 ){
    return false;
    }
    }
    function createTable() {
    var cubes = doc.getElements ByTagNameNS('ht tp://www.ecb.int/
    vocabulary/2002-08-01/eurofxref','Cub e');
    var dateRate = cubes[1].getAttribute(' time');
    var dateRateSplit = dateRate.split( '-');
    for (var i = 2; i < cubes.length; i++){
    var currency = cubes[i].getAttribute(' currency');
    var rate = cubes[i].getAttribute(' rate');
    rateObject[currency] = rate;
    }
    document.getEle mentById('boldS tuff').innerHTM L = dateRateSplit[2]
    + "." + dateRateSplit[1] + "." + dateRateSplit[0];
    document.getEle mentById("curre ncy").value = "GBP";
    getRates();
    };
    var rateObject = {};
    function getRates() {
    var curr= document.getEle mentById("curre ncy").value;
    var currRate = rateObject[curr];
    var currStatement= "1 EUR = " + currRate + " " + curr ;
    document.getEle mentById("rate" ).value=currSta tement;
    var currRev=1/currRate;
    currRevFix=curr Rev.toFixed(5);
    var currRevStatemen t= "1 " + curr +"= " + currRevFix + " EUR";
    document.getEle mentById("rateR ev").value=curr RevStatement;
    };
  • David Mark

    #2
    Re: Parsing XML with namespaces in IE.

    On Nov 2, 3:10 pm, Steve <stephen.jo...@ googlemail.comw rote:
    With the help of this newsgroup and Google I have got this code
    working fully in Firefox and can alert the XML in IE but because IE
    does not impliment the DOM "getElementsByT agNameNS()" function I
    cannot read the individual rates from the Cube namespace.
    At the present time, the MS XML DOM object does not support
    getElementsByTa gNameNS method, but it is certainly capable of reading
    data from elements in the document. See getElementsByTa gName,
    selectNodes and selectSingleNod e.


    >
    Is there a wrapper or some other relatively simple method of getting
    IE to do what in Firefox is straighforward?
    >
    Here is the code. Any help gratefully received.
    >
    var doc
    function load() {
       if (document.imple mentation &&
    document.implem entation.create Document){
    Always use typeof to test host methods (e.g. should be "object",
    "function" or "unknown".) Testing host methods by boolean type
    conversion is known to cause exceptions in IE.
                    doc = document.implem entation.create Document("", "", null);
                    doc.load('CEBra tes.xml');
                    doc.onload = createTable;
            }
            else if (window.ActiveX Object){
    I would test for more than "truthiness " here (should be a function.)
    And you are going to need a try-catch clause to deal with cases where
    ActiveX objects are disallowed, the XML DOM object is malfunctioning
    or any of the other dozen things that can go wrong with the
    instantiation.
                    var doc1 = new ActiveXObject(" Microsoft..XMLD OM");
          function loadXML(xmlFile ){
             doc1.async="fal se";
    Why are you setting a boolean property to a string? You are lucky the
    object doesn't throw an exception. No way to know if a future Windows
    update will break this.
             doc1.onreadysta techange=verify ;
             doc1.load(xmlFi le);
             doc=doc1.docume ntElement;
          }
          loadXML('CEBrat es.xml');
          alert(doc.xml)
    Use window.alert.
          }
          else {
                    alert('Your browser can\'t handle this script');
    Never do this. You are insulting the user's browser and you haven't
    the slightest idea if their browser can handle your script. And
    besides, how many of your users would know what you mean by "script?"
                    return;
         }}
    >
    function verify() {
        if (doc1.readyStat e != 4 ){
            return false;
       }}
    This function appears to be nonsense.

    [snip]

    Comment

    • David Mark

      #3
      Re: Parsing XML with namespaces in IE.

      On Nov 2, 11:30 pm, David Mark <dmark.cins...@ gmail.comwrote:
      On Nov 2, 3:10 pm, Steve <stephen.jo...@ googlemail.comw rote:
      >
      With the help of this newsgroup and Google I have got this code
      working fully in Firefox and can alert the XML in IE but because IE
      does not impliment the DOM "getElementsByT agNameNS()" function I
      cannot read the individual rates from the Cube namespace.
      >
      At the present time, the MS XML DOM object does not support
      getElementsByTa gNameNS method, but it is certainly capable of reading
      data from elements in the document.  See getElementsByTa gName,
      selectNodes and selectSingleNod e.
      >

      >
      >
      >
      Is there a wrapper or some other relatively simple method of getting
      IE to do what in Firefox is straighforward?
      >
      Here is the code. Any help gratefully received.
      >
      var doc
      function load() {
         if (document.imple mentation &&
      document.implem entation.create Document){
      >
      Always use typeof to test host methods (e.g. should be "object",
      "function" or "unknown".)  Testing host methods by boolean type
      conversion is known to cause exceptions in IE.
      >
      And, of course, if it is "object" then also test if it is
      "truthy" (else null passes.) Do *not* test the "truthiness " of
      "unknown" types as they will always throw exceptions. It should also
      be pointed out that "unknown" is not evidence of a method, only
      evidence that something is there. Removing an element from the DOM
      sets lots of properties (e.g. offsetParent) to "unknown" types.

      Search the group for "isHostMeth od" for a safe wrapper. Pass it names
      of host object properties that are known to be implemented as methods
      as IE's "unknown" types make it an unreliable test otherwise (e.g.
      offsetParent is not callable.)

      Comment

      • Steve

        #4
        Re: Parsing XML with namespaces in IE.

        This script is simply my first draft to get IE to read an XML file,
        something that is straightforward with browsers that support the W3C
        DOM Level 2 Core. The reason the code is messy is because I have had
        to make lots of changes to get IE to even load the XML. This is why I
        am asking the newsgroup for help. Thanks for answering but I'm afraid
        the following response doesn't answer my question, which was "Is there
        a wrapper or some other relatively simple method of getting IE to do
        what in Firefox is straighforward? " I will reply to some parts of the
        answer which are easy to answer and have nothing to do with the
        question I asked.
        On Nov 3, 5:30 am, David Mark <dmark.cins...@ gmail.comwrote:
        On Nov 2, 3:10 pm, Steve <stephen.jo...@ googlemail.comw rote:
        >
        Is there a wrapper or some other relatively simple method of getting
        IE to do what in Firefox is straighforward?
        This is the question I would appreciate an answer to.
        >
        Here is the code. Any help gratefully received.
        >
        var doc
        function load() {
        if (document.imple mentation &&
        document.implem entation.create Document){
        >
        Always use typeof to test host methods (e.g. should be "object",
        "function" or "unknown".) Testing host methods by boolean type
        conversion is known to cause exceptions in IE.
        This is not causing an exception.
        >
        doc = document.implem entation.create Document("", "", null);
        doc.load('CEBra tes.xml');
        doc.onload = createTable;
        }
        else if (window.ActiveX Object){
        >
        I would test for more than "truthiness " here (should be a function.)
        And you are going to need a try-catch clause to deal with cases where
        ActiveX objects are disallowed, the XML DOM object is malfunctioning
        or any of the other dozen things that can go wrong with the
        instantiation.
        OK
        var doc1 = new ActiveXObject(" Microsoft.XMLDO M");
        function loadXML(xmlFile ){
        doc1.async="fal se";
        >
        Why are you setting a boolean property to a string? You are lucky the
        object doesn't throw an exception. No way to know if a future Windows
        update will break this.
        Lucky?
        doc1.onreadysta techange=verify ;
        doc1.load(xmlFi le);
        doc=doc1.docume ntElement;
        }
        loadXML('CEBrat es.xml');
        alert(doc.xml)
        >
        Use window.alert.
        Why? Alert is used everywhere even in the Rhino book.
        }
        else {
        alert('Your browser can\'t handle this script');
        >
        Never do this. You are insulting the user's browser and you haven't
        the slightest idea if their browser can handle your script. And
        besides, how many of your users would know what you mean by "script?"
        This is only there until the script is working. No-one will see it as
        it is only on my localhost.
        function verify() {
        if (doc1.readyStat e != 4 ){
        return false;
        }}
        >
        This function appears to be nonsense.
        >
        This function is perfectly ok. Ready states are:
        0 Object is not initialized
        1 Loading object is loading data
        2 Loaded object has loaded data
        3 Data from object can be worked with
        4 Object completely initialized

        Regards, Steve.

        Comment

        • David Mark

          #5
          Re: Parsing XML with namespaces in IE.

          On Nov 3, 4:59 am, Steve <stephen.jo...@ googlemail.comw rote:
          This script is simply my first draft to get IE to read an XML file,
          something that is straightforward with browsers that support the W3C
          DOM Level 2 Core. The reason the code is messy is because I have had
          to make lots of changes to get IE to even load the XML. This is why I
          am asking the newsgroup for help. Thanks for answering but I'm afraid
          the following response doesn't answer my question, which was "Is there
          a wrapper or some other relatively simple method of getting IE to do
          what in Firefox is straighforward? "
          I answered that.
          I will reply to some parts of the answer which are easy to answer and have nothing to do with the
          question I asked.
          Odd choice. It's your dime.
          >
          On Nov 3, 5:30 am, David Mark <dmark.cins...@ gmail.comwrote:
          On Nov 2, 3:10 pm, Steve <stephen.jo...@ googlemail.comw rote:
          >
          Is there a wrapper or some other relatively simple method of getting
          IE to do what in Firefox is straighforward?
          >
          This is the question I would appreciate an answer to.
          I answered it.
          >
          >
          >
          Here is the code. Any help gratefully received.
          >
          var doc
          function load() {
             if (document.imple mentation &&
          document.implem entation.create Document){
          >
          Always use typeof to test host methods (e.g. should be "object",
          "function" or "unknown".)  Testing host methods by boolean type
          conversion is known to cause exceptions in IE.
          >
          This is not causing an exception.
          I didn't imply that it was. In fact, your test:

          if (document.imple mentation && document.implem entation.create Document)
          {

          would seem to preclude IE from evaluating the createDocument method.
          Just a general note of warning.
          >
          >
          >
                          doc = document.implem entation.create Document("", "", null);
                          doc.load('CEBra tes.xml');
                          doc.onload = createTable;
                  }
                  else if (window.ActiveX Object){
          >
          I would test for more than "truthiness " here (should be a function.)
          And you are going to need a try-catch clause to deal with cases where
          ActiveX objects are disallowed, the XML DOM object is malfunctioning
          or any of the other dozen things that can go wrong with the
          instantiation.
          >
          OK
          >
                          var doc1 = new ActiveXObject(" Microsoft.XMLDO M");
                function loadXML(xmlFile ){
                   doc1.async="fal se";
          >
          Why are you setting a boolean property to a string?  You are lucky the
          object doesn't throw an exception.  No way to know if a future Windows
          update will break this.
          >
          Lucky?
          I doubt it.
          >
                   doc1.onreadysta techange=verify ;
                   doc1.load(xmlFi le);
                   doc=doc1.docume ntElement;
                }
                loadXML('CEBrat es.xml');
                alert(doc.xml)
          >
          Use window.alert.
          >
          Why? Alert is used everywhere even in the Rhino book.
          I doubt that too. Perhaps alert is, but that doesn't make it right.
          Why would you use an unqualified reference to that method? Seems
          deliberately ambiguous.
          >
                }
                else {
                          alert('Your browser can\'t handle this script');
          >
          Never do this.  You are insulting the user's browser and you haven't
          the slightest idea if their browser can handle your script.  And
          besides, how many of your users would know what you mean by "script?"
          >
          This is only there until the script is working. No-one will see it as
          it is only on my localhost.
          Good.
          >
          function verify() {
              if (doc1.readyStat e != 4 ){
                  return false;
             }}
          >
          This function appears to be nonsense.
          >
          This function is perfectly ok. Ready states are:
          0 Object is not initialized
          1 Loading object is loading data
          2 Loaded object has loaded data
          3 Data from object can be worked with
          4 Object completely initialized
          >
          Despite that, the function is still nonsense in this context. As your
          code is admittedly a mess, why not pare it down a bit by removing
          obviously unneeded nonsense?

          Comment

          • Steve

            #6
            Re: Parsing XML with namespaces in IE.

            On Nov 3, 11:17 am, David Mark <dmark.cins...@ gmail.comwrote:
            On Nov 3, 4:59 am, Steve <stephen.jo...@ googlemail.comw rote:
            >
            This script is simply my first draft to get IE to read an XML file,
            something that is straightforward with browsers that support the W3C
            DOM Level 2 Core. The reason the code is messy is because I have had
            to make lots of changes to get IE to even load the XML. This is why I
            am asking the newsgroup for help. Thanks for answering but I'm afraid
            the following response doesn't answer my question, which was "Is there
            a wrapper or some other relatively simple method of getting IE to do
            what in Firefox is straighforward? "
            >
            I answered that.
            Then please clarify what your answer is. If it is imply giving a link
            to MS XML DOM Methods please be aware that that is not very helpful. I
            would appreciate some help in learning how to use these methods to do
            what getElementsByTa gNameNS() does.
            On Nov 3, 5:30 am, David Mark <dmark.cins...@ gmail.comwrote:
            On Nov 2, 3:10 pm, Steve <stephen.jo...@ googlemail.comw rote:
            >
            Is there a wrapper or some other relatively simple method of getting
            IE to do what in Firefox is straighforward?
            >
            This is the question I would appreciate an answer to.
            >
            I answered it.
            What is the answer? Simply giving a link to MS XML DOM Methods is not
            very helpful.
            doc1.onreadysta techange=verify ;
            doc1.load(xmlFi le);
            doc=doc1.docume ntElement;
            }
            loadXML('CEBrat es.xml');
            alert(doc.xml)
            >
            Use window.alert.
            >
            Why? Alert is used everywhere even in the Rhino book.
            >
            I doubt that too. Perhaps alert is, but that doesn't make it right.
            Why would you use an unqualified reference to that method? Seems
            deliberately ambiguous.
            >
            I will start the next sentence without capitalizing the first letter
            as it seems that script grammar is more important to you than english
            grammar. alert is a recognized method of debugging scripts. Its only
            there to see if the xml has been loaded.
            function verify() {
            if (doc1.readyStat e != 4 ){
            return false;
            }}
            >
            This function appears to be nonsense.
            >
            This function is perfectly ok. Ready states are:
            0 Object is not initialized
            1 Loading object is loading data
            2 Loaded object has loaded data
            3 Data from object can be worked with
            4 Object completely initialized
            >
            Despite that, the function is still nonsense in this context. As your
            code is admittedly a mess, why not pare it down a bit by removing
            obviously unneeded nonsense?
            It is not nonsense because it is necessary for the xml file to be
            completely initialized before attempting to read it.

            Comment

            • David Mark

              #7
              Re: Parsing XML with namespaces in IE.

              On Nov 3, 6:06 am, Steve <stephen.jo...@ googlemail.comw rote:
              On Nov 3, 11:17 am, David Mark <dmark.cins...@ gmail.comwrote:
              >
              On Nov 3, 4:59 am, Steve <stephen.jo...@ googlemail.comw rote:
              >
              This script is simply my first draft to get IE to read an XML file,
              something that is straightforward with browsers that support the W3C
              DOM Level 2 Core. The reason the code is messy is because I have had
              to make lots of changes to get IE to even load the XML. This is why I
              am asking the newsgroup for help. Thanks for answering but I'm afraid
              the following response doesn't answer my question, which was "Is there
              a wrapper or some other relatively simple method of getting IE to do
              what in Firefox is straighforward? "
              >
              I answered that.
              >
              Then please clarify what your answer is. If it is imply giving a link
              to MS XML DOM Methods please be aware that that is not very helpful. I
              would appreciate some help in learning how to use these methods to do
              what getElementsByTa gNameNS() does.
              Did you look at the examples in the documentation of any or all of the
              three methods I mentioned? Is there something in particular that
              confuses you?
              >
              On Nov 3, 5:30 am, David Mark <dmark.cins...@ gmail.comwrote:
              On Nov 2, 3:10 pm, Steve <stephen.jo...@ googlemail.comw rote:
              >
              Is there a wrapper or some other relatively simple method of getting
              IE to do what in Firefox is straighforward?
              >
              This is the question I would appreciate an answer to.
              >
              I answered it.
              >
              What is the answer? Simply giving a link to MS XML DOM Methods is not
              very helpful.
              See above.
              >
                       doc1.onreadysta techange=verify ;
                       doc1.load(xmlFi le);
                       doc=doc1.docume ntElement;
                    }
                    loadXML('CEBrat es.xml');
                    alert(doc.xml)
              >
              Use window.alert.
              >
              Why? Alert is used everywhere even in the Rhino book.
              >
              I doubt that too.  Perhaps alert is, but that doesn't make it right.
              Why would you use an unqualified reference to that method?  Seems
              deliberately ambiguous.
              >
              I will start the next sentence without capitalizing the first letter
              as it seems that script grammar is more important to you than english
              "Script grammar?"
              grammar. alert is a recognized method of debugging scripts. Its only
              there to see if the xml has been loaded.
              A "recognized method" is what exactly? An implied global method? It
              is indeed recognized as that and that is not a good thing. And, of
              course, you should not start an English sentence in lowercase.
              >
              >
              >
              function verify() {
                  if (doc1.readyStat e != 4 ){
                      return false;
                 }}
              >
              This function appears to be nonsense.
              >
              This function is perfectly ok. Ready states are:
              0 Object is not initialized
              1 Loading object is loading data
              2 Loaded object has loaded data
              3 Data from object can be worked with
              4 Object completely initialized
              >
              Despite that, the function is still nonsense in this context.  As your
              code is admittedly a mess, why not pare it down a bit by removing
              obviously unneeded nonsense?
              >
              It is not nonsense because it is necessary for the xml file to be
              completely initialized before attempting to read it.
              You are completely mistaken.

              Comment

              • Thomas 'PointedEars' Lahn

                #8
                Re: Parsing XML with namespaces in IE.

                David Mark wrote:
                [...] Do *not* test the "truthiness " of "unknown" types as they will
                always throw exceptions. It should also be pointed out that "unknown" is
                not evidence of a method, only evidence that something is there.
                Removing an element from the DOM sets lots of properties (e.g.
                offsetParent) to "unknown" types.
                Good remarks, thanks. I may have to refine my isMethod().


                PointedEars, pressing 1, 4 ;-)
                --
                Use any version of Microsoft Frontpage to create your site.
                (This won't prevent people from viewing your source, but no one
                will want to steal it.)
                -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

                Comment

                • Martin Honnen

                  #9
                  Re: Parsing XML with namespaces in IE.

                  Steve wrote:
                  With the help of this newsgroup and Google I have got this code
                  working fully in Firefox and can alert the XML in IE but because IE
                  does not impliment the DOM "getElementsByT agNameNS()" function I
                  cannot read the individual rates from the Cube namespace.
                  With IE you use MSXML for XML DOM, it implements methods selectNodes and
                  selectSingleNod e for DOM documents and elements (or even nodes in
                  general). With MSXML 3 and later you can pass an XPath 1.0 expression to
                  those two methods to select nodes:
                  var doc = new ActiveXObject(' Msxml2.DOMDocum ent.3.0');
                  doc.async = false;
                  if (doc.load('file .xml'))
                  {
                  // necessary for MSXML 3 first:
                  doc.setProperty ('SelectionLang uage', 'XPath');

                  // now bind prefixes to namespace URIs e.g.
                  doc.setProperty ('SelectionName spaces',
                  'xmlns:pf1="htt p://example.com/ns1" xmlns:pf2="http ://example.org/ns2"');

                  // and use those prefixes in XPath expresssions
                  var nodeList = doc.selectNodes ('pf1:foo/pf1:bar/pf2:baz');
                  // use nodeList here
                  }


                  --

                  Martin Honnen

                  Comment

                  • Steve

                    #10
                    Re: Parsing XML with namespaces in IE.

                    >On Nov 3, 5:30 am, David Mark <dmark.cins...@ gmail.comwrote:
                    On Nov 2, 3:10 pm, Steve <stephen.jo...@ googlemail.comw rote:
                    function verify() {
                    if (doc1.readyStat e != 4 ){
                    return false;
                    }}
                    >
                    This function appears to be nonsense.
                    >
                    This function is perfectly ok. Ready states are:
                    0 Object is not initialized
                    1 Loading object is loading data
                    2 Loaded object has loaded data
                    3 Data from object can be worked with
                    4 Object completely initialized
                    >
                    Despite that, the function is still nonsense in this context. As your
                    code is admittedly a mess, why not pare it down a bit by removing
                    obviously unneeded nonsense?
                    >
                    It is not nonsense because it is necessary for the xml file to be
                    completely initialized before attempting to read it.
                    >
                    You are completely mistaken.
                    I am asking for assistance here and you are only muddying the waters.
                    What am I mistaken about in your opinion? My understanding is that the
                    object (xml file) must be "ready state 4" before starting to be read.
                    You say that I am completely mistaken. Perhaps I am, but do you really
                    think this sort of reply is helpful?

                    Comment

                    • David Mark

                      #11
                      Re: Parsing XML with namespaces in IE.

                      On Nov 3, 8:31 am, Steve <stephen.jo...@ googlemail.comw rote:
                      On Nov 3, 5:30 am, David Mark <dmark.cins...@ gmail.comwrote:
                      On Nov 2, 3:10 pm, Steve <stephen.jo...@ googlemail.comw rote:
                      function verify() {
                          if (doc1.readyStat e != 4 ){
                              return false;
                         }}
                      >
                      This function appears to be nonsense.
                      >
                      This function is perfectly ok. Ready states are:
                      0 Object is not initialized
                      1 Loading object is loading data
                      2 Loaded object has loaded data
                      3 Data from object can be worked with
                      4 Object completely initialized
                      >
                      Despite that, the function is still nonsense in this context.  Asyour
                      code is admittedly a mess, why not pare it down a bit by removing
                      obviously unneeded nonsense?
                      >
                      It is not nonsense because it is necessary for the xml file to be
                      completely initialized before attempting to read it.
                      >
                      You are completely mistaken.
                      >
                      I am asking for assistance here and you are only muddying the waters.
                      Am I? Perhaps you are not equipped to deal with the assistance
                      offered?
                      What am I mistaken about in your opinion? My understanding is that the
                      object (xml file) must be "ready state 4" before starting to be read.
                      You say that I am completely mistaken. Perhaps I am, but do you really
                      think this sort of reply is helpful?
                      I have escalated your case. Somebody from level 2 support with be
                      with you shortly. Thank you for using comp.lang.javas cript.

                      Comment

                      • Thomas 'PointedEars' Lahn

                        #12
                        Re: Parsing XML with namespaces in IE.

                        David Mark wrote:
                        On Nov 3, 8:31 am, Steve <stephen.jo...@ googlemail.comw rote:
                        >What am I mistaken about in your opinion? My understanding is that the
                        >object (xml file) must be "ready state 4" before starting to be read.
                        >You say that I am completely mistaken. Perhaps I am, but do you really
                        >think this sort of reply is helpful?
                        >
                        I have escalated your case. Somebody from level 2 support with be
                        with you shortly. Thank you for using comp.lang.javas cript.
                        ROTFL. YMMD! :)


                        PointedEars, formerly first-then-second-level support
                        --
                        realism: HTML 4.01 Strict
                        evangelism: XHTML 1.0 Strict
                        madness: XHTML 1.1 as application/xhtml+xml
                        -- Bjoern Hoehrmann

                        Comment

                        • David Mark

                          #13
                          Re: Parsing XML with namespaces in IE.

                          On Nov 3, 4:14 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
                          wrote:
                          David Mark wrote:
                          On Nov 3, 8:31 am, Steve <stephen.jo...@ googlemail.comw rote:
                          What am I mistaken about in your opinion? My understanding is that the
                          object (xml file) must be "ready state 4" before starting to be read.
                          You say that I am completely mistaken. Perhaps I am, but do you really
                          think this sort of reply is helpful?
                          >
                          I have escalated your case.  Somebody from level 2 support with be
                          with you shortly.  Thank you for using comp.lang.javas cript.
                          >
                          ROTFL.  YMMD! :)
                          >
                          PointedEars, formerly first-then-second-level support
                          LOL. Did you get kicked upstairs?

                          Comment

                          • Thomas 'PointedEars' Lahn

                            #14
                            Re: Parsing XML with namespaces in IE.

                            David Mark wrote:
                            Thomas 'PointedEars' Lahn wrote:
                            >David Mark wrote:
                            >>On Nov 3, 8:31 am, Steve <stephen.jo...@ googlemail.comw rote:
                            >>>What am I mistaken about in your opinion? My understanding is that the
                            >>>object (xml file) must be "ready state 4" before starting to be read.
                            >>>You say that I am completely mistaken. Perhaps I am, but do you really
                            >>>think this sort of reply is helpful?
                            >>I have escalated your case. Somebody from level 2 support with be
                            >>with you shortly. Thank you for using comp.lang.javas cript.
                            >ROTFL. YMMD! :)
                            >>
                            >PointedEars, formerly first-then-second-level support
                            >
                            LOL. Did you get kicked upstairs?
                            Yep, and believe me, work was a lot more fun then :)


                            PointedEars
                            --
                            realism: HTML 4.01 Strict
                            evangelism: XHTML 1.0 Strict
                            madness: XHTML 1.1 as application/xhtml+xml
                            -- Bjoern Hoehrmann

                            Comment

                            • David Mark

                              #15
                              Re: Parsing XML with namespaces in IE.

                              On Nov 3, 6:53 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
                              wrote:
                              David Mark wrote:
                              [...]  Do *not* test the "truthiness " of "unknown" types as they will
                              always throw exceptions.  It should also be pointed out that "unknown" is
                              not evidence of a method, only evidence that something is there.
                              Removing an element from the DOM sets lots of properties (e.g.
                              offsetParent) to "unknown" types.
                              >
                              Good remarks, thanks.  I may have to refine my isMethod().
                              Has isMethodType been retired? Everyone should be using some
                              variation of this as the number of "unknown" types may grow with IE8.
                              I suppose it is possible they could add new types as well. Why they
                              (MS) would do this is anyone's guess. But such behavior is clearly
                              allowed for host objects and IE has been more or less consistent in
                              this regard for a decade. IE7 did add a couple of new "unknown"
                              wrinkles, but they follow the same rules.

                              At the very least, those who wish to implement proper feature testing
                              should be aware of this issue. It helps to avoid such train-of-
                              thought wrecks as this:



                              I have seen numerous attempts at explanations for the bizarre
                              getAttribute comment (none by the author of course.) I am certain
                              that there are circumstances in IE where evaluating this host object
                              method will throw an exception. I am also certain that the typeof
                              operator will safely reveal its type as "unknown" in all such cases.
                              IIRC, IE's XML elements have always been rigged to explode in this way.

                              Comment

                              Working...