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

Re: [svg-developers] getURL/XMLHTTP

Expand Messages
  • Sean
    This appears to be a an issue harder to solve than I thought it would be. Below is my javascript code that for the most part works, except for one thing, the
    Message 1 of 34 , Jun 28, 2006
    View Source
    • 0 Attachment
      This appears to be a an issue harder to solve than I thought it would
      be. Below is my javascript code that for the most part works, except for
      one thing, the Adobe viewer won't let me call getURL, parse it with
      parseXML, and then insert into an svg doc that is not the calling
      document. I get:

      ---------------------------
      Script error
      ---------------------------
      Wrong document
      line: 22, column: 16

      Any thoughts on how to get around this would be very much appreciated.

      // JavaScript Document
      function addMenu(evt){
      myUrlString = ("F4-Test.php?&menu=Planning");
      getURL(myUrlString,addMenu2);
      }

      function addMenu2(data) {
      // alert(data.content);
      if(data.success) {
      var node = parseXML(data.content, document);
      var xml = node.firstChild;
      var id = xml.getAttribute('id');
      var myMenuToAdd;
      child = node.firstChild.firstChild;
      while(child != null){
      // get sibling BEFORE parent changes
      childSibling = child.nextSibling;
      if(child.nodeType==1){
      // alert(window.printNode(child));
      myMenuToAdd =
      parent.document.F4B.getSVGDocument().getElementById("PlanningCanvas");
      myMenuToAdd.appendChild(child);
      }
      child = childSibling;
      }
      }else {
      alert("something went wrong!");
      }
      }
    • Sean
      Thank you so much. At first, I completely missed the relevance of what you said. Then it hit me. Basically, instead of var node = parseXML(data.content,
      Message 34 of 34 , Jun 29, 2006
      View Source
      • 0 Attachment
        Thank you so much. At first, I completely missed the relevance of what
        you said. Then it hit me. Basically, instead of
        var node = parseXML(data.content, document);

        I needed:
        var node = parseXML(data.content, parent.document.F4B.getSVGDocument());

        Perfect!

        Sean

        Martin Honnen wrote:

        > --- In svg-developers@yahoogroups.com
        > <mailto:svg-developers%40yahoogroups.com>, Sean <scene@...> wrote:
        > >
        > > Do you actually append it into an embedded svg doc other than the svg
        > > doc you use to get your segment? Both my calling doc and the doc
        > > associated with the parseXML are svg. I just can't get it to append
        > into
        > > a third svg doc.
        >
        > > > var node = parseXML(data.content, document);
        >
        > You should pass that document to the parseXML function as its second
        > argument that you want to insert the nodes into.
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.