You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Benjamin Campin <bc...@dbxgeomatics.com> on 2004/03/25 14:40:56 UTC
appendChild and Batik1.5.1 : how to insert the content of another svg
to my svg
Hi folk,
I have posted this question on yahoo group (svg-developers), but I guess the
best place to post it, is in here.
I would like to dynanically insert the content of a svg in my main svg
But when doing the getURL, in the callback,
I got the following Error "Null is not a GraphicsNode" when Batik
1.5.1 is doing the appendChild, (after the parseXML, see code below)
I know that appendChild() is working in Batik when doing a
CreateElement, but how to insert the content of an svg, or a string
like '<g id="mygroup"><rect id="myrect" .../>...</g>'?
Cheers,
Benjamin
---
function getCallbackHandler(grp){
var cb = function(urlRequestStatus)
{
var string='';
if (urlRequestStatus.success)
{
string=urlRequestStatus.content;
}else{return;}
var docFragment=parseXML(string, document);
var content = document.getElementById (cb.insertAfter);
content.appendChild(docFragment);
}
cb.insertAfter=grp;
return cb;
}
function addLayer(url, grp){
getURL(url,getCallbackHandler(grp));
}
RE: appendChild and Batik1.5.1 : how to insert the content of another
svg to my svg
Posted by Benjamin Campin <bc...@dbxgeomatics.com>.
Solved,.
I did not use the appendChild to insert the the content of the svg,
I used a <image> with the href to the svg file.
Working good.
Benjamin
_____
From: Benjamin Campin [mailto:bc@dbxgeomatics.com]
Sent: March 25, 2004 8:41 AM
To: batik-users@xml.apache.org
Subject: appendChild and Batik1.5.1 : how to insert the content of another
svg to my svg
Hi folk,
I have posted this question on yahoo group (svg-developers), but I guess the
best place to post it, is in here.
I would like to dynanically insert the content of a svg in my main svg
But when doing the getURL, in the callback,
I got the following Error "Null is not a GraphicsNode" when Batik
1.5.1 is doing the appendChild, (after the parseXML, see code below)
I know that appendChild() is working in Batik when doing a
CreateElement, but how to insert the content of an svg, or a string
like '<g id="mygroup"><rect id="myrect" .../>...</g>'?
Cheers,
Benjamin
---
function getCallbackHandler(grp){
var cb = function(urlRequestStatus)
{
var string='';
if (urlRequestStatus.success)
{
string=urlRequestStatus.content;
}else{return;}
var docFragment=parseXML(string, document);
var content = document.getElementById (cb.insertAfter);
content.appendChild(docFragment);
}
cb.insertAfter=grp;
return cb;
}
function addLayer(url, grp){
getURL(url,getCallbackHandler(grp));
}