importNode and root node name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

    importNode and root node name

    at the page :
    <http://thoraval.yvon.f ree.fr/Fixed_layout/import_nodes.xh tml>
    when importing an svg document i have to do :
    document.import Node(
    req.responseXML .getElementsByT agName(req.para meters.root)[0],true))

    (lines 46/47)

    in case of SVG : req.parameters. root = 'svg'
    and 'math' in case of MathML


    there is no DOM method for getting the root node, enabling not to
    specify the root is svg|math ???

    or could i do that using DOM/XPath ?

    ie something like :
    req.responseXML .evaluate('/',document, nsResolver, XPathResult.ANY _TYPE,
    null);

    ???
    --
    Une Bévue
  • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

    #2
    Re: importNode and root node name

    Une Bévue <unbewusst.sein @weltanschauung .com.invalidwro te:
    >
    there is no DOM method for getting the root node, enabling not to
    specify the root is svg|math ???

    req.responseXML .documentElemen t

    response given over the french clj (fr.c.l.j)

    --
    Une Bévue

    Comment

    • Martin Honnen

      #3
      Re: importNode and root node name

      Une Bévue wrote:
      at the page :
      <http://thoraval.yvon.f ree.fr/Fixed_layout/import_nodes.xh tml>
      when importing an svg document i have to do :
      document.import Node(
      req.responseXML .getElementsByT agName(req.para meters.root)[0],true))
      >
      (lines 46/47)
      >
      in case of SVG : req.parameters. root = 'svg'
      and 'math' in case of MathML
      >
      >
      there is no DOM method for getting the root node, enabling not to
      specify the root is svg|math ???
      >
      or could i do that using DOM/XPath ?
      >
      ie something like :
      req.responseXML .evaluate('/',document, nsResolver, XPathResult.ANY _TYPE,
      null);
      >
      ???
      The root element is simply accessible as
      req.responseXML .documentElemen t

      The root node in the XPath data model is the document node in the DOM
      model thus if you want to access the root node then you simply need
      req.responseXML
      However you can't import document nodes.


      --

      Martin Honnen

      Comment

      • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

        #4
        Re: importNode and root node name

        Martin Honnen <mahotrash@yaho o.dewrote:
        >
        The root element is simply accessible as
        req.responseXML .documentElemen t
        >
        The root node in the XPath data model is the document node in the DOM
        model thus if you want to access the root node then you simply need
        req.responseXML
        However you can't import document nodes.
        OK, fine thanks !
        --
        Une Bévue

        Comment

        • Bjoern Hoehrmann

          #5
          Re: importNode and root node name

          * Une Bévue wrote in comp.lang.javas cript:
          >at the page :
          ><http://thoraval.yvon.f ree.fr/Fixed_layout/import_nodes.xh tml>
          >when importing an svg document i have to do :
          >document.impor tNode(
          >req.responseXM L.getElementsBy TagName(req.par ameters.root)[0],true))
          >
          >(lines 46/47)
          >
          >in case of SVG : req.parameters. root = 'svg'
          >and 'math' in case of MathML
          When dealing with elements in a namespace you should instead use the
          method getElementsByTa gNameNS() and properly specify the namespace in
          addition to the local name, like

          .getElementsByT agNameNS('http://www.w3.org/2000/svg', 'svg');
          >or could i do that using DOM/XPath ?
          >
          >ie something like :
          >req.responseXM L.evaluate('/',document, nsResolver, XPathResult.ANY _TYPE,
          >null);
          You would select '/*' to get the root element as opposed to the root
          node.
          --
          Björn Höhrmann · mailto:bjoern@h oehrmann.de · http://bjoern.hoehrmann.de
          Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
          68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

          Comment

          • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

            #6
            Re: importNode and root node name

            Bjoern Hoehrmann <bjoern@hoehrma nn.dewrote:
            >
            When dealing with elements in a namespace you should instead use the
            method getElementsByTa gNameNS() and properly specify the namespace in
            addition to the local name, like
            >
            .getElementsByT agNameNS('http://www.w3.org/2000/svg', 'svg');
            OK, then, i do have to assume i was somehow "lucky" when not specifying
            the ns ? (that works without it)
            or could i do that using DOM/XPath ?

            ie something like :
            req.responseXML .evaluate('/',document, nsResolver, XPathResult.ANY _TYPE,
            null);
            >
            You would select '/*' to get the root element as opposed to the root
            node.
            then a dom/xpath expression isn't equivalent to an xslt/xpath one ?

            i understand '/*' takes the root + everything below it.

            '/' takes the node only.

            and again, i'd have to specify the ns :

            '/xhtml|svg|math: *'

            this is unclear to me because when i specify '//xhtml:body' (for example
            in the dropdown at
            <http://thoraval.yvon.f ree.fr/Fixed_layout/editable_dropdo wn.xhtmlonly
            tested on Mac OS X : firefox ans safari)

            i'm able to log the children and attributes.

            i think i misunderstood the difference between node and element...
            --
            Une Bévue

            Comment

            • Bjoern Hoehrmann

              #7
              Re: importNode and root node name

              * Une Bévue wrote in comp.lang.javas cript:
              >then a dom/xpath expression isn't equivalent to an xslt/xpath one ?
              >
              >i understand '/*' takes the root + everything below it.
              No, this matches any element that is a child of the root node. There can
              only be one element with the root node as parent, the root element. This
              is the same wherever you use XPath. The root node and everything below
              it would be //node(), for example.
              >this is unclear to me because when i specify '//xhtml:body' (for example
              >in the dropdown at
              ><http://thoraval.yvon.f ree.fr/Fixed_layout/editable_dropdo wn.xhtmlonly
              >tested on Mac OS X : firefox ans safari)
              But //* is very different from /*.
              --
              Björn Höhrmann · mailto:bjoern@h oehrmann.de · http://bjoern.hoehrmann.de
              Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
              68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

              Comment

              • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

                #8
                Re: importNode and root node name

                Bjoern Hoehrmann <bjoern@hoehrma nn.dewrote:
                >
                No, this matches any element that is a child of the root node. There can
                only be one element with the root node as parent, the root element. This
                is the same wherever you use XPath. The root node and everything below
                it would be //node(), for example.
                OK, clear enough, thanks !
                >
                this is unclear to me because when i specify '//xhtml:body' (for example
                in the dropdown at
                <http://thoraval.yvon.f ree.fr/Fixed_layout/editable_dropdo wn.xhtmlonly
                tested on Mac OS X : firefox ans safari)
                >
                But //* is very different from /*.
                yes clearly ))
                --
                Une Bévue

                Comment

                • Holger Jeromin

                  #9
                  Re: importNode and root node name

                  Une Bévue schrieb am 26.04.2008 19:02:
                  Bjoern Hoehrmann <bjoern@hoehrma nn.dewrote:
                  this is unclear to me because when i specify '//xhtml:body' (for example
                  in the dropdown at
                  <http://thoraval.yvon.f ree.fr/Fixed_layout/editable_dropdo wn.xhtmlonly
                  tested on Mac OS X : firefox ans safari)
                  Just for your Information:

                  Internet Explorer gives a download Requester for each xhtml file (sent
                  by xhtml+xml)



                  --
                  Mit freundlichen Grüßen
                  Holger Jeromin

                  Comment

                  • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

                    #10
                    Re: importNode and root node name

                    Holger Jeromin <news03_2008@ka tur.dewrote:
                    >
                    Internet Explorer gives a download Requester for each xhtml file (sent
                    by xhtml+xml)
                    yes, i know even if i can't test over win* ...

                    but could i implement xhtml served as text/html with more than 4
                    namespaces ???

                    vielen dank ;-)
                    --
                    Une Bévue

                    Comment

                    • Holger Jeromin

                      #11
                      Re: importNode and root node name

                      Une Bévue schrieb am 26.04.2008 20:46:
                      Holger Jeromin <news03_2008@ka tur.dewrote:
                      >Internet Explorer gives a download Requester for each xhtml file (sent
                      >by xhtml+xml)
                      yes, i know even if i can't test over win* ...
                      >
                      but could i implement xhtml served as text/html with more than 4
                      namespaces ???
                      you can, but it is not nice and can only used for IE, because Opera und
                      FF don't support this as a HTML mess.
                      vielen dank ;-)
                      :-)

                      --
                      Mit freundlichen Grüßen
                      Holger Jeromin

                      Comment

                      • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

                        #12
                        Re: importNode and root node name

                        Holger Jeromin <news03_2008@ka tur.dewrote:
                        >
                        you can, but it is not nice and can only used for IE, because Opera und
                        FF don't support this as a HTML mess.
                        OK, seems strange to me the fact the guys of Microsoft have less man
                        power than Apple for that kind of things...

                        they argue about "improving our CSS support" and html parser where i
                        discovered today the latest WebKit (safari) even the Gtk version for
                        gnome is 100% Acid3 test successfull...

                        tchuss !

                        --
                        Une Bévue

                        Comment

                        Working...