xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Kolesnikov ...@sundraw.ws>
Subject Problem with xlink namespace?
Date Sat, 01 Apr 2006 17:46:43 GMT
Hello everyone,

I am trying to create in Java code a simple SVG document with a text on 
a path, but I am having the same error whatever I try:

org.apache.batik.bridge.BridgeException: null:-1
An I/O error occured while processing the URI:
""
specified on the element <textPath>

I suspect that the problem is in how I am dealing with XLink namespace, 
but how to do this properly - I don't know. Here is an abbreviated 
version of the code I am trying to write:

Element root = document.getDocumentElement();

// I need to add the XLink namespace, so this is how I am trying to do that
root.setAttributeNS("xmlns", "xlink", "http://www.w3.org/1999/xlink");

Element defs = document.createElementNS(svgNS, "defs");
root.appendChild(defs);

Element path0 = document.createElementNS(svgNS, "path");
path0.setAttributeNS(null , "id", "path0");
path0.setAttributeNS(null, "d", "M 20 20 L 200 200");
defs.appendChild(path0);

Element textElement = document.createElementNS(svgNS, "text");
Element textPath = document.createElementNS(svgNS, "textPath");
textPath.setAttributeNS("xlink", "href", "path0");
Text text = document.createTextNode("Some text");

textPath.appendChild(text);
textElement.appendChild(textPath);
textElement.setAttributeNS(null, "font-family", "Verdana");
textElement.setAttributeNS(null, "font-size", "20");
root.appendChild(textElement);

Where I am wrong?

Thanks,

Alexander


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message