getElementsByTagName is unreliable in IE/ASV. You haven't given a lot
of details but I suspect this is your problem. we had similar
problems and wrote a replacement function and the problem went away.
Guy
On 25/04/2007, at 9:26 PM, krugerboy1971 wrote:
> I am trying to load some external GML map data into an SVG document
> - and it is working
> 99% fine.
>
> 1. It works perfectly in Firefox
> 2. It works in ASV - but I get intermittent error messages ('Object
> required') when calling
> the function sometimes. On some occasions, It'll load the same GML
> data just fine.
>
> It seems that, at some stage during the loop for svg polygon
> creation, ASV can't read the
> GML elements which have been loaded into the 'xmlobjects' <g> element.
>
> My code is below - anyone had anything similar happen? or any ideas
> why ASV is behaving
> so erratically?
>
> function addGeom(node) {
> clearXMLCache();//function to clear temporary area for GML loaded
> svgDoc.getElementById('xmlobjects'.appendChild(node)//puts new GML
> content in
> temporary area
> clearMapCache();//function clears out previous map geometry for the
> SVG
> pathBuilder();//function to convert GML data into SVG syntax
> }
>
> //MAIN function
> function pathBuilder() {
> var myData = svgDoc.getElementById('xmlobjects');
> var TargetLayer = svgDoc.getElementById('gmlcontent');
>
> var aID = new Array();
> var aPaths = new Array();
> var myTile =
> myData.getElementsByTagNameNS(gmlNS,"featureMember");
> var myBBox = myData.getElementsByTagNameNS(gmlNS,"Box").item(0);
> var myBBoxData = myBBox.getElementsByTagNameNS
> (gmlNS,"coordinates").item(0).firstChild.data;
> var a = myBBoxData.split(",");
> var b = a[1].split(" ");
> var newX = a[0];
> var newWidth=b[1]-a[0];
> var newHeight=a[2]-b[0];
> var tempy = parseInt(b[0])+parseInt(newHeight);
> var newY = 1100000-tempy;
> var newViewbox = newX+' '+newY+' '+newWidth+' '+newHeight;
> svgDoc.getElementById('mapwindow').setAttributeNS
> (null,'viewBox',newViewbox);
> nFeatures = myTile.length;//number of objects in the map data
> for (i=0;i<nFeatures;i++) {
> var myFeature = myTile.item(i);
> var myPathData = 'M';//starts a path element for a map
> feature
> var myCode = myFeature.getElementsByTagNameNS("http://
> www.esri.com/WFS",'RESIDENCE').item(0).firstChild.data;
> var myPolygons = myFeature.getElementsByTagNameNS
> (gmlNS,'coordinates');
> //inner loop to deal with multi-polygons and
> donuts - adds a
> 'moveto' command
> for (j=0;j<myPolygons.length;j++) {
> var myCoords =
> myPolygons.item(j).textContent;
> if (myCoords ==null) {
> myCoords =
> myPolygons.item(j).firstChild.data;
> } //End of if
> if (j>0) {
> myPathData = myPathData+'
> M'+myCoords;
> } else {
> myPathData =
> myPathData+myCoords;
> } //end of if
> } //End of inner for loop
> //close path and update path array
> myPathData = myPathData+'Z';
> aID[i] = myCode;
> aPaths[i] = myPathData;
> } //end of outer for loop
> var newGroup = svgDoc.createElementNS('http://www.w3.org/2000/
> svg',"g");
> newGroup.setAttributeNS(null,'id','polygongroup');
> TargetLayer.appendChild(newGroup);
> var PathTargetLayer = svgDoc.getElementById('polygongroup');
> for (k=0;k<nFeatures;k++) {
> //CREATE PATH ELEMENT AND APPEND TO DOCUMENT
> var newPath =
> svgDoc.createElementNS('http://www.w3.org/2000/
> svg',"path");
> newPath.setAttributeNS(null,'d',aPaths[k]);
> newPath.setAttributeNS(null,'id','GML_'+aID[k]);
> PathTargetLayer.appendChild(newPath);
> } //End of for loop
> } //End of function
>
>
>
>
> -----
> To unsubscribe send a message to: svg-developers-
> [EMAIL PROTECTED]
> -or-
> visit http://groups.yahoo.com/group/svg-developers and click "edit
> my membership"
> ----
> Yahoo! Groups Links
>
>
>
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/