hello, perhaps this is a pure trivial DOM question, sorry in that case:

I have a canvas with a loaded document (ALWAYS_DYNAMIC)



I want to add a piece of SVG document to the canvas' document. To do that, I
try to use the DomUtiliities Class.

String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
Node foo = DOMUtilities.parseXML(text,
canvas.getSVGDocument(),canvas.getURI(), null, null,f);
final Element parent = canvas.getSVGDocument().getElementById("Components");
parent.appendChild(foo);
System.out.println("foo appended");

I want to add this piece of SVG (value of the text variable):
<text id="fooText" ...>FOO</text>

but then, the returned node is null (createDocument fails). I suppose <text>
is not enought, I have to specify it is SVG.

Then, I surrounded the text tag with a <!DOCTYPE..><svg> ... </svg> and it
works well. But when I look to my SVG document, it contains the SVG tag.
<svg...>
  <g id="Components">
    <svg ...>
      <text ...>
   </svg>
  </g>
  ...
</svg>

How can I have this:?
<svg...>
  <g id="Components">
      <text ...>
  </g>
  ...
</svg>

thank's

-- 
Dao Hodac

Reply via email to