how to handle textPath in svg

Poster Content
nk4um User
Posts: 131
August 26, 2008 11:43Thanks
As always an excellent response Menzo. Next time I''m in Amsterdam I''ll buy you a beer (or whatever your poison is ;-) !

Regards,
Tom
Like · Post Reply
nk4um User
Posts: 111
August 26, 2008 09:39
Even an SVG document has to be a valid XML document, so the xlink namespace has to be declared. So just add it to your svg root element:

<svg width="100%" height="100%" version="1.2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
...
</svg>


See also the "Example: XLink namespace declaration" at:

http://www.w3.org/TR/SVGMobile12/linking.html#xlinkRefAttrs

where just above the following text can be found:

In all cases, for compliance with either the "Namespaces in XML 1.0" or the "Namespaces in XML 1.1" Recommendation [XML-NS10][XML-NS], an explicit XLink namespace declaration must be provided whenever one of the above XLink attributes is used within SVG content. One simple way to provide such an XLink namespace declaration is to include an xmlns attribute for the XLink namespace on the ''svg'' element for content that uses XLink attributes.


There is no escape ;-)

Hope this helps,

Menzo
Like · Post Reply
nk4um User
Posts: 131
August 26, 2008 08:57how to handle textPath in svg
Greetings,
In my XRLlinks.xml I have the following :
<int>active:imageSVG2PNG+operand@ffcpl:/resources/busy.svg+operator@ffcpl:/resources/svg2png.xml</int>


This works fine as long as busy.svg is very simple. However, when it gets a bit more complex, like ...

<svg width="100%" height="100%" version="1.2" xmlns="http://www.w3.org/2000/svg">
<defs>
  <path id="theCircle" d="M20,45 C20,10 70,10 70,45 M70,45 C70,80 20,80 20,45"/>
</defs>

<circle cx="45" cy="45" r="40" stroke="black" stroke-width="2" fill="red"/>
<text style="font-size:14;font-family:verdana">
   <textPath xlink:href="#theCircle">Busy-Busy-Busy-Busy-
   </textPath>
</text>
</svg>

It throws the typical sax error ...
org.xml.sax.SAXParseException
The prefix "xlink" for attribute "xlink:href" associated with an element type "textPath" is not bound.


I "understand" why that is, but on the other hand ... this is valid SVG-syntax ... so how can I write my statement so the imageSVG2PNG-parser gets my input without going through the sax-parser first ?

Regards,
Tom
Like · Post Reply