Parsing XML with namespaces in IE.

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

    #16
    Re: Parsing XML with namespaces in IE.

    On Nov 3, 1:03 pm, Martin Honnen <mahotr...@yaho o.dewrote:
    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
       }
    Thank you Martin for a helpful reply. I have now got IE reading the
    XML thanks to your post.

    Regards,

    Steve

    Comment

    • Steve

      #17
      Re: Parsing XML with namespaces in IE.

      On Nov 3, 1:03 pm, Martin Honnen <mahotr...@yaho o.dewrote:
      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
         }
      Thank you Martin for a helpful reply. I have now got IE reading the
      XML thanks to your post.

      Regards,

      Steve

      Comment

      • Thomas 'PointedEars' Lahn

        #18
        Re: Parsing XML with namespaces in IE.

        Thomas 'PointedEars' Lahn wrote:
        David Mark wrote:
        >Thomas 'PointedEars' Lahn 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?
        >
        I have replaced it largely with isMethod() in dhtml.js [...]
        JFTR: dhtml.js:_addEv entListener():3 which is

        if (o && sEvent && isMethodType(fL istener) && fListener)

        should be

        if (o && sEvent && isMethodType(ty peof fListener) && fListener)

        This bug is FIXED since version 0.9.4.200804232 1 (unreleased).


        PointedEars
        --
        var bugRiddenCrashP ronePieceOfJunk = (
        navigator.userA gent.indexOf('M SIE 5') != -1
        && navigator.userA gent.indexOf('M ac') != -1
        ) // Plone, register_functi on.js:16

        Comment

        • David Mark

          #19
          Re: Parsing XML with namespaces in IE.

          On Nov 4, 1:49 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
          wrote:
          David Mark wrote:
          Thomas 'PointedEars' Lahn 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?
          >
          I have replaced it largely with isMethod() in dhtml.js (which is going tobe
          renamed to dom.js or something like that -- existing URIs are still goingto
          work).  However, there are some instances where I think isMethodType() is
          still needed.
          >
          [typeof x == "unknown"]
          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:
          >>
          OMG.
          >
          Indeed. Odd that hasn't been pulled by now. Everybody who reads it
          has the same reaction. Well, most everybody. See today's posts on
          the subject.

          Comment

          • Thomas 'PointedEars' Lahn

            #20
            Re: Parsing XML with namespaces in IE.

            David Mark wrote:
            Thomas 'PointedEars' Lahn 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.
            >>offsetParen t) to "unknown" types.
            >Good remarks, thanks. I may have to refine my isMethod().
            >
            Has isMethodType been retired?
            I have replaced it largely with isMethod() in dhtml.js (which is going to be
            renamed to dom.js or something like that -- existing URIs are still going to
            work). However, there are some instances where I think isMethodType() is
            still needed.
            [typeof x == "unknown"]
            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:
            >
            http://ejohn.org/blog/future-proofin...ipt-libraries/
            OMG.


            PointedEars
            --
            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

            • Steve

              #21
              Re: Parsing XML with namespaces in IE.

              On Nov 4, 8:04 pm, David Mark <dmark.cins...@ gmail.comwrote:
              On Nov 4, 1:49 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
              wrote:
              >
              >
              >
              David Mark wrote:
              Thomas 'PointedEars' Lahn 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.
              >>offsetParen t) to "unknown" types.
              >Good remarks, thanks.  I may have to refine my isMethod().
              >
              Has isMethodType been retired?
              >
              I have replaced it largely with isMethod() in dhtml.js (which is going to be
              renamed to dom.js or something like that -- existing URIs are still going to
              work).  However, there are some instances where I think isMethodType() is
              still needed.
              >
              [typeof x == "unknown"]
              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:
              >>
              OMG.
              >
              Indeed.  Odd that hasn't been pulled by now.  Everybody who reads it
              has the same reaction.  Well, most everybody.  See today's posts on
              the subject.
              Have you two wankers finished hijacking this thread?

              Comment

              Working...