svg - getSVGDocument repeatedly throwing "0x80020003 - JavaScript runtime error: Member not found" -


the uk office national statistics provide access data uk 2011 national census. 1 access method provide through soap api , give examples of how consume api on page ness data exchange v2.0. having trouble getting 1 example working. it’s under nde v2.0 excel client in zip nde hub client rest v2.0 (zip) 37 mb, "hub demo excel-based application allows user build repository of saved data, , view via svg thematic map".

the map <div> svg data added page these lines (in 'sources/thematicmap.htm')

document.writeln('<div id=mappanel style="position:absolute;left:26%;top:7%; height=63%; width=50%;">') document.writeln('<embed height=100% width=100% name=svgmap src="../boundaries/' + svgfile + '" type=image/svg-xml>') document.writeln('</div>'); 

(n.b. original code ..\\boundaries\\ changed ../boundaries/. both lead same error.)

putting breakpoint on middle line reveals svgfile variable set "la_12ub.svg" , file present in 'boundaries' directory. here how 'boundaries/la_12ub.svg' starts.

<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/css" href="external.css" ?> <!doctype svg public "-//w3c//dtd svg 20000303 stylable//en" "http://www.w3.org/tr/2000/03/wd-svg-20000303/dtd/svg-20000303-stylable.dtd"> <svg xml:space="preserve"  preserveaspectratio="xminymin meet" id="mainsvg" width="395" height="420" viewbox="0 0 900 650">    <g class="mapedge" opacity="0.2">       <rect x="0" y="0" width="100%" height="100%"/>               </g>   <svg xml:space="preserve" preserveaspectratio="xminymin meet" id="map" onload="init(evt)" width="100%" height="100%" viewbox="541512 -262080 7829 10000">       <g class="mapbackground" transform="translate(1000,500) scale(1, -1)">           <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"/> 

i.e. appears correctly formed , full of svg data.

'sources/thematicmap.htm' contains line

<body onload="initialise()"> 

that calls initialise in 'includes/startup.js'. initialise exception thrown. when code reaches line

svgmapdoc = document.svgmap.getsvgdocument(); 

the error 0x80020003 - javascript runtime error: member not found raised. setting breakpoint can see document.svgmap not null nor undefined, though appear full of default values rather wealth of path data i’d expect (but i’m not sure that).

the question how check if embedded svg document loaded in html page? may relevant. cannot use erik dahlström's answer since rely on onload suggests. have tried mocky's answer thus

function checksvgmapready() {     try {         svgmapdoc = document.svgmap.getsvgdocument();     } catch (e) { }     if (svgmapdoc === undefined) {         settimeout("checksvgmapready()", 300);     } else {         svgmapready();     } } 

but each time through iterative call same error caught.

(n.b. think examples tested ie6, ie7, firefox 2, @ least readme file in of examples states, while using ie10. have tried chrome , firefox too, , while not see same error message not see svg data rendered either.)

does have idea why call getsvgdocument throwing 0x80020003 - javascript runtime error: member not found , how fix it?

there seem number of issues here.

type=image/svg-xml invalid. must use type=image/svg+xml.

then think should try doing this...

  if (document.svgmap && document.svgmap.contentdocument)     svgmapdoc = document.svgmap.contentdocument;   else try {     svgmapdoc = document.svgmap.getsvgdocument();   }   catch(exception) {     alert('neither htmlobjectelement nor getsvgdocument interface implemented');   } 

finally code initialise svgmapdoc called onload event of body, should onload of embed triggers somehing this...

document.writeln('<embed height=100% width=100% onload="initialise()" name=svgmap src="../boundaries/' + svgfile + '" type=image/svg+xml>') 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -