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

Re: SVG in SVG (problem still not solved)

Expand Messages
  • hssn_2002000
    ... me a ... when a ... technique - ... this ... become ... although I ... other ... use
    Message 1 of 52 , Apr 2, 2008
    • 0 Attachment
      --- In svg-developers@yahoogroups.com, Helder Magalhães
      <helder.magalhaes@...> wrote:
      >
      > > Hi Guys,
      > > I'm still waiting for some help in this area. Please suggest
      me a
      >
      > Please note that persistence [1] may work against you instead of
      > helping you to get more feedback. Some courtesy [2] may help also.
      >
      >
      > > way to call SVG image in a SVG file to be opened only in firefox.
      >
      > I was just moving to the next thread (my mental filter has almost
      > blocked this thread due to the already stated persistence) but
      when a
      > quick idea came by:
      >
      > 1. Fetch SVG document to embed using XHR [2] or equivalent
      technique -
      > an utility wrapper (such as Andreas Neumann's [4]) may help doing
      this
      > in a way which is compatible with most SVG implementations.
      > 2. Parse the fetched XML (there's a recent post [5] which may
      become
      > useful)
      > 3. Get SVG element's children.
      > 4. Iterate over them, filtering known elements which will probably
      > break your document and insert remaining into a target element
      >
      >
      > Code snippet (untested):
      > // NOTE: fetchedDocument is parseXML's resulting document
      > var svgEle = fetchedDocument.getElementsByTagName("svg").item(0);
      > for(var childEle = svgEle .firstChild; childEle != null; svgEle =
      > svgEle.nextSibling){
      > switch(childEle.tagName){
      > case "defs":
      > case "script":
      > case "metadata":
      > // do nothing - these will probably break parent document
      > break;
      > default:
      > // OK, insert this one
      > document.appendChild(childEle);
      > break;
      > }
      > }
      >
      >
      > Known caveats with this approach:
      > 1. Fetched document coordinate system must be compatible with host
      > document;
      > 2. Avoiding key elements will remove scripting and library (defs)
      > support from fetched document. Not avoiding them may break host
      > document (although it wasn't tested).
      >
      > This may have several other issues as the approach wasn't tested -
      > nevertheless, it may help guiding towards the right direction! ;-)
      >
      > Also, this may have already been proposed in other threads,
      although I
      > wasn't able to find much related in a quick search.
      >
      > Finally, I realized this approach can be used to help implementing
      > external document references (use xlink:href="other.svg#myObj") for
      > implementations which don't support the feature yet (Firefox and
      other
      > [6]). This could be achieved by a similar trick which was used to
      > overcome an ASV issue [7], but in this scope it would iterate over
      > relevant elements (mostly "use", although other elements can also
      use
      > external references for gradients and such). If someone wants to
      > pickup this and marsh up an implementation... :-)
      >
      > Hope this helps,
      >
      > Helder Magalhães
      >
      > [1] http://catb.org/~esr/faqs/smart-questions.html#bespecific
      > [2] http://catb.org/~esr/faqs/smart-questions.html#courtesy
      > [3] http://www.w3.org/TR/XMLHttpRequest/
      > [4] http://www.carto.net/papers/svg/network_requests/index.shtml
      > [5] http://tech.groups.yahoo.com/group/svg-developers/message/59950
      > [6] http://tech.groups.yahoo.com/group/svg-developers/message/59956
      > [7] http://tech.groups.yahoo.com/group/svg-developers/message/60185
      >
    • Frank Bruder
      Hi, Sujana, have you seen this post: http://tech.groups.yahoo.com/group/svg-developers/message/60214 Looks to me like Bruce Rindahl already has a solution for
      Message 52 of 52 , Apr 5, 2008
      • 0 Attachment
        Hi, Sujana,
        have you seen this post:
        http://tech.groups.yahoo.com/group/svg-developers/message/60214

        Looks to me like Bruce Rindahl already has a solution for what you
        are trying.

        Regards
        Frank


        --- In svg-developers@yahoogroups.com,
        "sujana_jyothi" <sujana_jyothi@...> wrote:
        >
        > Hi Helder Magalhães,
        > Thanks for your code snippet. I still havent tried out if it
        works
        > or not. I will try it and will get back to you. And apologies if my
        > previous message was abrupt. I thought, I did speak in a requesting
        > way and I did say "please suggest me".......
        >
        > Anyways, Thanks once again....
        > Sujana.
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.