if i do that, The error of that the element to append is not created for the
actual document, appears.

what else , should i have to do?.



Bishop, Michael W. CONTR J9C880-2 wrote:
> 
> Shouldn't that last line be:
>  
> root.appendChild(elementToinsert, true)?  Your "ele" variable is
> initialized to a root element which would be the <svg> element.
>  
> Michael
> 
> ________________________________
> 
> From: control_batik [mailto:[EMAIL PROTECTED]
> Sent: Wed 11/5/2008 10:20 AM
> To: [email protected]
> Subject: adding a <g> element generates a <svg> , creating a two <svg>
> into a single file
> 
> 
> 
> 
> Hi all,
> 
> I use these lines to add a <g> tag into a new <svg> tag:
> 
> final Element root = basedocument.getDocumentElement();
> final Element ele = newGraphElement.getRootelement();               
> elementToinsert = (Element)
> newGraphElement.getRootelement().getElementsByTagName("g").item(0);
> elementToinsert.setAttribute("transform", "translate("  
> newGraphElement.getPosX()   ","   newGraphElement.getPosY()   ")");
> root.appendChild(basedocument.importNode(ele, true));
> 
> They work perfectly. I use "transform" to insert the element in a
> specific location.
> I save the generated svg file using DOMUtilities.writeDocument.
> When I open the file with Inkscape it looks ok.
> 
> When I use the same code to insert the generated file into a empty svg
> file,
> I saw that only one element its located correctely (I use a JSVGCanvas),
> and
> the
> others elements are located in the 0,0 position.
> 
> I open the generated file in a text editor, I see that  the number of svg
> tags are as much as I insert a <g> tag with code before.
> 
> So, that explains why only the first inserted element is located well ,
> the
> atribute transform only moves the first svg tag in the file.
> 
> the question is, How can i insert only a <g> tag instead of a  <svg> tag?
> .
> 
> the generated file has this structure:
> <svg...><g></g> <svg...></svg></svg><svg...><g></g></svg>
> 
> I want something like this:
> <svg>
> <g></g>
> <g></g>
> <g></g>
> </svg>
> 
> Thank you for your help.
> --
> View this message in context:
> http://www.nabble.com/adding-a-%3Cg%3E-element-generates-a-%3Csvg%3E-%2C-creating-a-two-%3Csvg%3E-into-a-single-file-tp20343192p20343192.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
View this message in context: 
http://www.nabble.com/adding-a-%3Cg%3E-element-generates-a-%3Csvg%3E-%2C-creating-a-two-%3Csvg%3E-into-a-single-file-tp20343192p20362139.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to