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 Scheit Christoph <ch...@siemens.com> on 2005/08/11 10:04:06 UTC
Rendering order / children
Hello!
I want to create child-nodes for an element, let's say a rectangle.
1)
elem.appendChild(rect); // rect is the new, elem an already exising
rectangle
If I try like this, it doesn't work (i.e.the child is not rendered!?!)
If I just add it to the root element
2)
svgDoc.getDocumentElement().appendChild(rect);
it works (but they are not children, what I want to have since they are
logically related in the application).
Is there any possibility to do it like in example 1) ??
Thank you very much,
Christoph
Re: Rendering order / children
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Christoph,
Scheit Christoph wrote:
> I want to create child-nodes for an element, let’s say a rectangle.
Rectangles can't have child graphics nodes. Mostly just
'g', 'svg' and 'symbol' elements can have child graphics nodes.
> 1) elem.appendChild(rect);
> // rect is the new, elem an already exising rectangle
You might try:
elem.getParentNode().appendChild(rect);
This will make the new rect a sibling of 'elem'.
You can also use:
elem.getParentNode().insertBefore(rect, elem.getNextSibling());
To make sure rect is the very next sibling of elem.
> If I just add it to the root element
> 2) svgDoc.getDocumentElement().appendChild(rect);
> it works (but they are not children, what I want to have since they are
> logically related in the application).
>
> Is there any possibility to do it like in example 1) ??
I think you really want them to be siblings not parent child.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org