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

Re: [svg-developers] Re: need innerSVG type of functionality.

Expand Messages
  • narendra sisodiya
    I know about serialisation, But How can i get full SVG DOM. there are two javascript -- one in HTML document and other ECMAscript in svg. SAVE button will
    Message 1 of 9 , Feb 6, 2009
    • 0 Attachment
      I know about serialisation, But How can i get full SVG DOM.
      there are two javascript -- one in HTML document and other ECMAscript in
      svg.
      "SAVE" button will trigger ECMAfunction which return serialised SVG string,
      currently I am using

      SvgToString

      function from http://www.mecxpert.de/svg/domtree.html

      But for this, i need to apply this function on all svg elements one by one.
      i tried applying this function on SVG root element but failed to do that.
      is there any easy way to upload a modified SVG image to server.

      at on instance, i saw, somebody has used innerHTML over a div which embed
      svg image, and he is getting full svg as string, But in my case, this is not
      working, i am getting

      <embed src="blank.svg" type="image/svg+xml" width="350px" height="360px">

      using innerHTML.


      [Non-text portions of this message have been removed]
    • Frank Bruder
      I have written a Javascript function to get string representations of XML DOM nodes. A description and a link to the script can be found at
      Message 2 of 9 , Feb 6, 2009
      • 0 Attachment
        I have written a Javascript function to get string representations of
        XML DOM nodes. A description and a link to the script can be found at
        <http://frankbruder.fr.ohost.de/FeSVGDoc/save.xhtml>
        It's an older project. There are some bugs. Namely, the escaping of
        special characters and of non-ascii characters is not correct in
        certain cases. But it mostly works. I've got a newer implementation of
        this function somewhere.


        Hope this helps. Regards
        Frank

        --- In svg-developers@yahoogroups.com, narendra sisodiya
        <narendra.sisodiya@...> wrote:
        >
        > Deal all,
        > recently am trying my effort to make a "online svg editor" --
        here is
        > a demo -- http://wiki.techfandu.org/eduvid/svg-edit/svg-editor.html ,
        >
        > I need to save dynamically created SVG image to server. for this, I
        need to
        > get SVG image as string in HTML javascript. I have implemented save
        svg ,
        > but only for path element. it is complex procedure so i need your
        > suggestion,
        > my most of the files are seen at
        http://wiki.techfandu.org/eduvid/svg-edit/
        >
        > --
        >
        â"Œâ"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"
        > â"‚ Narendra Sisodiya ( नरेन्द्र
        सिसोदिया )
        > â"‚ R&D Engineer
        > â"‚ http://narendra.techfandu.org
        >
        â""â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"˜
        >
        >
        > [Non-text portions of this message have been removed]
        >
      • Robin Berjon
        ... I presume that you tried calling innerHTML on the object element, and naturally it returned its HTML content, which is the above. Two questions: - why
        Message 3 of 9 , Feb 6, 2009
        • 0 Attachment
          On Feb 6, 2009, at 17:28 , narendra sisodiya wrote:
          > at on instance, i saw, somebody has used innerHTML over a div which
          > embed
          > svg image, and he is getting full svg as string, But in my case,
          > this is not
          > working, i am getting
          >
          > <embed src="blank.svg" type="image/svg+xml" width="350px"
          > height="360px">
          >

          I presume that you tried calling innerHTML on the object element, and
          naturally it returned its HTML content, which is the above.

          Two questions:

          - why don't you just put the SVG inline instead of pointing to it
          from object/embed? It should work in most browsers except IE (though
          you'll probably need to make your HTML document XHTML) and then you
          could probably just call innerHTML on whatever is around it.

          - if you want to stick with an external document, have you tried
          iframe instead of object/embed? It should work fine, and you might try
          to call yourIframe.contentDocument.innerHTML see if it won't return
          something you can use.


          --
          Robin Berjon - http://berjon.com/
          Feel like hiring me? Go to http://robineko.com/
        • narendra sisodiya
          ... Thanks a Lot, I was not knowing about inline SVG ( http://wiki.svg.org/Inline_SVG ). now i will change my code and will try both method... inline and
          Message 4 of 9 , Feb 6, 2009
          • 0 Attachment
            On Fri, Feb 6, 2009 at 10:16 PM, Robin Berjon <robin@...> wrote:

            > On Feb 6, 2009, at 17:28 , narendra sisodiya wrote:
            > > at on instance, i saw, somebody has used innerHTML over a div which
            > > embed
            > > svg image, and he is getting full svg as string, But in my case,
            > > this is not
            > > working, i am getting
            > >
            > > <embed src="blank.svg" type="image/svg+xml" width="350px"
            > > height="360px">
            > >
            >
            > I presume that you tried calling innerHTML on the object element, and
            > naturally it returned its HTML content, which is the above.
            >
            > Two questions:
            >
            > - why don't you just put the SVG inline instead of pointing to it
            > from object/embed? It should work in most browsers except IE (though
            > you'll probably need to make your HTML document XHTML) and then you
            > could probably just call innerHTML on whatever is around it.
            >
            > - if you want to stick with an external document, have you tried
            > iframe instead of object/embed? It should work fine, and you might try
            > to call yourIframe.contentDocument.innerHTML see if it won't return
            > something you can use.
            >



            Thanks a Lot, I was not knowing about inline SVG (
            http://wiki.svg.org/Inline_SVG ). now i will change my code and will try
            both method... inline and iframe,,,,
            I used http://wiki.svg.org/Inter-Document_Communication to communicate
            between SVG and HTML functions, This document use embed tabs , so I used.
            --
            ┌─────────────────────────┐
            │ Narendra Sisodiya ( नरेन्द्र सिसोदिया )
            │ R&D Engineer
            http://narendra.techfandu.org
            └─────────────────────────┘


            [Non-text portions of this message have been removed]
          • ddailey
            I happened to notice the following text in http://www.w3.org/TR/html5/dom.html ... 2.5.3 Dynamic markup insertion in XML In an XML context, the
            Message 5 of 9 , Feb 6, 2009
            • 0 Attachment
              I happened to notice the following text in http://www.w3.org/TR/html5/dom.html

              ---------------
              2.5.3 Dynamic markup insertion in XML
              In an XML context, the document.write() method must raise an INVALID_ACCESS_ERR exception.

              On the other hand, however, the innerHTML attribute is indeed usable in an XML context.
              ---------------

              Does that mean that all HTML5 compliant browsers will (if that document becomes accepted) support innerHTML in SVG?

              You'll recall that Adobe's SVG plugin implemented a .printNode method for that.

              David


              ----- Original Message -----
              From: Frank Bruder
              To: svg-developers@yahoogroups.com
              Sent: Friday, February 06, 2009 11:45 AM
              Subject: [svg-developers] Re: need innerSVG type of functionality.


              I have written a Javascript function to get string representations of
              XML DOM nodes. A description and a link to the script can be found at
              <http://frankbruder.fr.ohost.de/FeSVGDoc/save.xhtml>
              It's an older project. There are some bugs. Namely, the escaping of
              special characters and of non-ascii characters is not correct in
              certain cases. But it mostly works. I've got a newer implementation of
              this function somewhere.

              Hope this helps. Regards
              Frank

              --- In svg-developers@yahoogroups.com, narendra sisodiya
              <narendra.sisodiya@...> wrote:
              >
              > Deal all,
              > recently am trying my effort to make a "online svg editor" --
              here is
              > a demo -- http://wiki.techfandu.org/eduvid/svg-edit/svg-editor.html ,
              >
              > I need to save dynamically created SVG image to server. for this, I
              need to
              > get SVG image as string in HTML javascript. I have implemented save
              svg ,
              > but only for path element. it is complex procedure so i need your
              > suggestion,
              > my most of the files are seen at
              http://wiki.techfandu.org/eduvid/svg-edit/
              >
              > --
              >
              â"Œâ"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"
              > â"‚ Narendra Sisodiya ( नरेन्द्र
              सिसोदिया )
              > â"‚ R&D Engineer
              > â"‚ http://narendra.techfandu.org
              >
              â""â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"€â"˜
              >
              >
              > [Non-text portions of this message have been removed]
              >




              [Non-text portions of this message have been removed]
            • narendra sisodiya
              2009/2/7 ddailey ... my problem got solved , I was sending incorrect SVGRoot variable to function just use this function
              Message 6 of 9 , Feb 7, 2009
              • 0 Attachment
                2009/2/7 ddailey <ddailey@...>

                > I happened to notice the following text in
                > http://www.w3.org/TR/html5/dom.html
                >



                my problem got solved , I was sending incorrect SVGRoot variable to function
                just use this function http://www.mecxpert.de/svg/domtree.html
                and call use this syntax to get a dynamic svg

                var str = "<?xml version=\"1.0\" standalone=\"no\"?> \
                <!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \
                \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> \n"
                str = str + SvgToString(SVGRoot );

                --
                ┌─────────────────────────┐
                │ Narendra Sisodiya ( नरेन्द्र सिसोदिया )
                │ R&D Engineer
                http://narendra.techfandu.org
                └─────────────────────────┘


                [Non-text portions of this message have been removed]
              • Robin Berjon
                ... It s a long way away, but yes, I would expect that to be the case. In fact, I would expect all browsers that support innerHTML and SVG to support using
                Message 7 of 9 , Feb 8, 2009
                • 0 Attachment
                  On Feb 6, 2009, at 21:13 , ddailey wrote:
                  > Does that mean that all HTML5 compliant browsers will (if that
                  > document becomes accepted) support innerHTML in SVG?
                  >

                  It's a long way away, but yes, I would expect that to be the case. In
                  fact, I would expect all browsers that support innerHTML and SVG to
                  support using them together soon, if they don't already (I haven't
                  tested).

                  --
                  Robin Berjon - http://berjon.com/
                  Feel like hiring me? Go to http://robineko.com/
                Your message has been successfully submitted and would be delivered to recipients shortly.