maria ulfa schrieb: > hi, > > i want to call some data in GML from an object with the same id in > SVG, i tried to use DOM, but it didn't work. > Can't DOM be used to read XML data from another XML document? > > how can we call an element with a specified attribute. i can't use > xmlDoc.selectNodes(XPath pattern) with Javascript and i can't find > another way. > > i really need your help. > thanks for the attention, > Hi Maria
in mozilla/firefox with native SVG support you can use xmlDoc.evaluate() which is documented here: http://www-jcsu.jesus.cam.ac.uk/~jg307/mozilla/xpath-tutorial.html here is a simple example how you would use document.evaluate() in svg: <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none" onmousemove="mmove(evt)" xmlns:xlink="http://www.w3.org/1999/xlink" onload="init()" > <script> function init(){ //using evaluate to get an XPathResultSet var rects = document.evaluate("/*//svg:rect", document,resolveNS, XPathResult.ANY_TYPE,null); //iterate the result set currentRect=rects.iterateNext() while(currentRect){ alert(currentRect.id) currentRect=rects.iterateNext() } } function resolveNS(st){ switch(st){ case "svg": return "http://www.w3.org/2000/svg" break; } } </script> <rect id="rect1" x="0%" y="0%" width="100%" height="100%" /> <circle id="circle1" cx="0" cy="0" r="50"/> <rect id="rect2" x="0%" y="0%" width="100%" height="100%" /> <g> <circle id="circle2" cx="0" cy="0" r="50"/> <rect id="rect3" x="0%" y="0%" width="100%" height="100%" /> </g> </svg> hth Holger ----- 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/ <*> 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/

