Guy/Domenico/All

Thanks for you all your comments

Even allowing for my inefficient coding and typos (;o)) it does appear to be a 
problem with 
getElementsByTagNameNS, so thanks to Guy for the tip-off.  I think we will 
completely re-
do the code to work by navigating through the DOM.  

One of the the other benefits in doing that approach might be (much needed) 
performance 
improvements in FF, since getElementById and getElementByTagNameNS both seem to 
slow down FF while it seaches a document rather than get pointed to the right 
part of it.

Will report back at some stage in the future about the re-worked version.

Alan


--- In [email protected], Guy Morton <[EMAIL PROTECTED]> wrote:
>
> I'll take *your* word for that, since I didn't analyse the code  
> supplied... :-)
> 
> Out of interest, anyone else ever see intermittent failures from  
> getElementsByTagName in IE/ASV? As in, nodes occasionally not being  
> found?
> 
> I should point out we use the browser's JavaScript engine, not ASV's.  
> That might make a difference.
> 
> Perhaps it is just us, and the problem lies elsewhere. Perhaps the  
> fact that our replacement code solves the problem we had when using  
> getElementsByTagName is a red herring.
> 
> Guy
> 
> 
> On 27/04/2007, at 10:05 AM, domenico_strazzullo wrote:
> 
> > --- In [email protected], Guy Morton <guy@> wrote:
> >>
> >> We have found on anything but the smallest XML nodes that
> >> getElementsByTagName sometimes fails to find nodes that our
> >> replacement function finds 100% reliably. YMMV, but that's what we've
> >> found and since this person is reporting an intermittent null object
> >> error the symptoms match.
> >
> > Oh, I believe you, nevertheless in this particular case the script, if
> > it has to convert, say, 1000 elements, is actually executing 499499
> > conversions. If the function call comes from a for loop without
> > setTimeout (which we don't know) no wonder if there's a massive
> > overflow. The basic problem is in the structure.
> >
> >> I guess in the absence of any word back about this we'll never know
> >> if getElementsByTagName was to blame in this case.
> >>
> >> Guy
> >
> > Guess so...
> >
> > Domenico
> >
> >
> >
> >>
> >> On 27/04/2007, at 1:53 AM, domenico_strazzullo wrote:
> >>
> >>> Hum... to my experience getElementsByTagNameNS works very well in
> >>> IE/ASV. There's a syntax error in the script but I suppose it's  
> >>> just a
> >>>    typo while pasting portions of the script, somehow? (It's always
> >>> better to include scripts as they appear in the editor). I also
> >>> suppose you're calling addGeom(node) from a for loop, so I think the
> >>> architecture you're using is not safe, in that you are  
> >>> recursively and
> >>> unnecessarily repopulating myTile. Worse for worse, declare it as
> >>> global and push the new element. As a test, reading childNodes or
> >>> hasChildNodes or myTile.length might very well give anarchic  
> >>> results.
> >>> I would rather play it safe, i.e. append all the children first, and
> >>> then execute the data conversions. And by the way, if  
> >>> "featureMember"s
> >>> are the only children of 'xmlobjects' then you can skip creating
> >>> myTyle altogether and just use xmlobjects.childNodes instead; why  
> >>> make
> >>> a new large array when one exists already. The way it is now it  
> >>> should
> >>> never work very well.
> >>>
> >>>> 99% fine.
> >>>
> >>> What happens to the remaining 1%? (just kidding).
> >>>
> >>> Domenico
> >>>
> >>>
> >>> --- In [email protected], Guy Morton <guy@> wrote:
> >>>>
> >>>> 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 =-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: 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: 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/
 

Reply via email to