--- In [email protected], "kberckma" <[EMAIL PROTECTED]>
wrote:
>
> I have a html document with an emtpy, embedded svg document.
> I want to fill this svg document with dojo from an xml file containing
> a rect element.
> First i tried to create a new rectangle (in code, object called rect)
> and add it to the svg. That worked in IE, not in firefox.


> Although both svgrect and rect show "rect" as its nodeName in the
> alert, only the rect object gets drawn in svg.

That is a namespace issue, make sure your SVG elements are in the
proper namespace http://www.w3.org/2000/svg so that snippet you send
should be corrected to

> <response><g id="layer00"><rect width="463.91238" height="431.20969"
> x="15" y="42" id="landschap0"></rect></g></response>

<response><g xmlns="http://www.w3.org/2000/svg"; id="layer00"><rect
width="463.91238" height="431.20969"
x="15" y="42" id="landschap0"></rect></g></response>

and all your DOM creation calls should use e.g.

> var group = svgdoc.createElement("g");

  var group = svgdoc.createElementNS("http://www.w3.org/2000/svg";, "g");

> var rect = svgdoc.createElement("rect");

  var rect = svgdoc.createElementNS("http://www.w3.org/2000/svg";, "rect")


That should fix issues for Firefox/Mozilla. Note however that the W3C
DOM wants you to use importNode to copy nodes from one document to
another, thus if you receive some XML document and want to copy nodes
from the received document to the SVG document you should use e.g.


var svgdoc = document.embeds["svgmap"].getSVGDocument();

var svgrect = svgdoc.importNode(xml.firstChild.firstChild.firstChild,
true);


As for IE and Adobe SVG viewer, I have doubts that your approach will
work there, if you use a toolkit in the HTML document receiving XML
then it will build that received XML DOM probably with MSXML while you
later want to insert nodes into the SVG DOM the Adobe viewer exposes.
And moving/copying nodes from one DOM implementation to a completely
different DOM implementation does usually not work. 






-----
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/
 


Reply via email to