Topic - how to handle textPath in svg
Topic - how to handle textPath in svg Topic - how to handle textPath in svg
from forum Component Developer
 forum index   my profile   search 
 new topic  post reply 
moderators: pjr tab
how to handle textPath in svg
Joined: 22-April-2007
Posts: 79
Location: Belgium
Posted: 26-August-2008 09:57
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
Joined: 14-March-2005
Posts: 60
Location: Amsterdam, The Netherlands
Posted: 26-August-2008 10: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
Thanks
Joined: 22-April-2007
Posts: 79
Location: Belgium
Posted: 26-August-2008 12:43
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
 new topic  post reply  To find out about new replies to this post as they occur
please subscribe to one of these feeds:
AtomRSS moderate 
© 2003-2006, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.