title: getSVGDocument repeatedly throwing "0x80020003 - JavaScript runtime error: Member not found"
body: <p>The UK Office for National Statistics provide access to the data from the UK 2011 national census. One access method they provide is through a SOAP API and they give examples of how to consume their API on the page <a href="http://neighbourhood.statistics.gov.uk/dissemination/Info.do?page=nde.htm" rel="nofollow noreferrer">NeSS Data Exchange V2.0</a>. I am having trouble getting one example working. It’s under <a href="http://neighbourhood.statistics.gov.uk/dissemination/Info.do?page=NDE-2-0-Excel.htm" rel="nofollow noreferrer">NDE v2.0 Excel Client</a> in the ZIP <a href="http://neighbourhood.statistics.gov.uk/HTMLDocs/downloads/Hub_Client_REST_2_0.zip" rel="nofollow noreferrer">NDE Hub Client REST v2.0 (Zip) 37 Mb</a>, a "hub demo Excel-based application which allows the user to build up a repository of saved data, and view it via an SVG thematic map".</p>
  
  <p>The map <code>&lt;DIV&gt;</code> SVG data is added to the page by these lines (in 'Sources/ThematicMap.htm')</p>
  
  <pre><code>document.writeln('&lt;DIV id=mapPanel style="position:absolute;left:26%;top:7%; height=63%; width=50%;"&gt;')
  document.writeln('&lt;EMBED height=100% width=100% name=svgMap src="../Boundaries/' + svgFile + '" type=image/svg-xml&gt;')
  document.writeln('&lt;/DIV&gt;');
  </code></pre>
  
  <p>(N.B. Their original code is <code>..\\Boundaries\\</code> but I changed it to <code>../Boundaries/</code>. Both lead to the same error.)</p>
  
  <p>Putting a breakpoint on that middle line reveals that the <code>svgFile</code> variable is set to "la_12UB.svg" and that file is present in the 'Boundaries' directory. Here is how 'Boundaries/la_12UB.svg' starts.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
  &lt;?xml-stylesheet type="text/css" href="external.css" ?&gt;
  &lt;!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN" "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd"&gt;
  &lt;svg xml:space="preserve"  preserveAspectRatio="xMinYMin meet" id="MainSVG" width="395" height="420" viewBox="0 0 900 650"&gt; 
    &lt;g class="mapEdge" opacity="0.2"&gt;
        &lt;rect x="0" y="0" width="100%" height="100%"/&gt;            
    &lt;/g&gt;
    &lt;svg xml:space="preserve" preserveAspectRatio="xMinYMin meet" id="Map" onload="init(evt)" width="100%" height="100%" viewBox="541512 -262080 7829 10000"&gt;
        &lt;g class="mapBackground" transform="translate(1000,500) scale(1, -1)"&gt;
            &lt;path id="00JA" d="M 533246,308907 534698,301468 539690,302984 540167,303513 539729,302866 534716,301443 527492,299370 527194,299301 522976,298284 523340,298070 522788,297938 522896,297322 522287,296297 522752,296256 523134,295665 522992,295319 522142,295666 521979,295371 521209,295267 520981,294831 520598,295324 519801,295441 519692,294834 520037,294424 519608,293815 519307,293871 519182,293126 517207,292629 517375,292088 516523,291182 516301,291471 515933,291255 515710,292076 514043,294384 513155,295603 513611,295848 513756,296170 513511,296320 512826,296386 512500,296931 512035,297564 510765,297353 510349,297748 509529,297818 509347,298690 508718,299559 507903,299503 507472,299058 506810,299452 503855,298555 503186,298398 503176,298820 502294,299230 501879,299841 502341,300260 502671,301563 502968,301637 503035,302936 503435,302942 503614,303338 503418,304478 502550,305148 502370,304967 501950,305791 502644,306453 503260,306347 503212,306752 503764,306896 504753,306844 504914,307391 507122,306620 507966,306784 508919,307439 510829,308187 511058,308184 512364,308996 512669,309872 514367,309757 516476,308975 517551,307531 517895,307411 520168,309004 520976,309160 521409,309326 522343,307609 523190,308534 525850,307595 525946,307970 528419,309965 529405,309387 530284,310000 530904,310008 531006,310370 531399,310254 532300,309733 533178,309331 533246,308907 z"/&gt;
  </code></pre>
  
  <p>I.e. it appears to be correctly formed and full of SVG data.</p>
  
  <p>'Sources/ThematicMap.htm' also contains the line </p>
  
  <pre><code>&lt;BODY onload="initialise()"&gt;
  </code></pre>
  
  <p>that calls <code>initialise</code> in 'Includes/Startup.js'. <code>initialise</code> is where the exception is thrown. When the code reaches the line </p>
  
  <pre><code>svgMapDoc = document.svgMap.getSVGDocument();
  </code></pre>
  
  <p>the error <code>0x80020003 - JavaScript runtime error: Member not found</code> is raised. Setting a breakpoint I can see that <code>document.svgMap</code> is not <code>null</code> nor <code>undefined</code>, though it does appear to be full of default values rather than the wealth of path data I’d expect (but I’m not sure where to look for that).</p>
  
  <p>The question <a href="https://stackoverflow.com/q/337293/575530">How to check if an embedded SVG document is loaded in an html page?</a> may be relevant. I cannot use <a href="https://stackoverflow.com/a/3510578/575530">Erik Dahlström's answer</a> since I already rely on <code>onload</code> as he suggests. I have tried <a href="https://stackoverflow.com/a/337383/575530">Mocky's answer</a> thus</p>
  
  <pre><code>function checkSVGMapReady() {
      try {
          svgMapDoc = document.svgMap.getSVGDocument();
      } catch (e) { }
      if (svgMapDoc === undefined) {
          setTimeout("checkSVGMapReady()", 300);
      } else {
          svgMapReady();
      }
  }
  </code></pre>
  
  <p>But each time through the iterative call the same error is caught.</p>
  
  <p>(N.B. I think the examples were tested for IE6, IE7, Firefox 2, at least that is what the readme file in another of their examples states, while I am using IE10. I have tried Chrome and Firefox too, and while I do not see the same error message I do not see the SVG data rendered either.)</p>
  
  <p>Does anyone have any idea why the call to <code>getSVGDocument</code> is throwing <code>0x80020003 - JavaScript runtime error: Member not found</code> and how to fix it?</p>