W3C home > Mailing lists > Public > www-svg@w3.org > April 2009

Re: Trouble extending line element

From: Doug Schepers <schepers@w3.org>
Date: Tue, 14 Apr 2009 08:18:02 -0400
Message-ID: <49E47EFA.6040305@w3.org>
To: "G. Wade Johnson" <gwadej@anomaly.org>
CC: Ben Temperton <benmpe@pml.ac.uk>, www-svg@w3.org
Hi, Ben-

What Wade said.

http://www.w3.org/TR/SVG11/extend.html#PrivateElementsAndAttribute

Regards-
-Doug Schepers
W3C Team Contact, SVG and WebApps WGs


G. Wade Johnson wrote (on 4/14/09 7:57 AM):
> Instead of going the DTD route, you might want to try using a separate
> namespace. That's supported by all of the viewers I'm aware of (and I'm
> sure I'll be corrected if I forgot any<grin/>).
>
> For example, see the changes I've made below.
>
>
> On Tue, 14 Apr 2009 10:11:13 +0100
> "Ben Temperton"<benmpe@pml.ac.uk>  wrote:
>
>>  Hi there,
>>  I'm currently trying to extend the SVG DTD to allow me to have a new
>>  element in the<line>  element like this:
>>  <?xml version="1.0" encoding="UTF-8"?>
>>  <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN'
>>  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
>>  <!ENTITY % SVG.line.extra.content "| hit">
>>  <!ELEMENT hit (queryId, queryString)>
>>  <!ELEMENT queryId (#PCDATA)>
>>  <!ELEMENT queryString (#PCDATA)>  ]>
>>  <svg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>       xmlns:xalan="http://xml.apache.org/xalan"
>>       xmlns:xlink="http://www.w3.org/1999/xlink"
>>       xmlns="http://www.w3.org/2000/svg"
>         xmlns:bt="http://pml.ac.uk/bens_extensions"
>>       style="fill-opacity:1; color-rendering:auto;
>>  color-interpolation:auto; stroke:black; text-rendering:auto;
>>  stroke-linecap:square; stroke-miterlimit:10; stroke-opacity:1;
>>  shape-rendering:auto; fill:black; stroke-dasharray:none;
>>  font-weight:normal; stroke-width:1; font-family:'Dialog';
>>  font-style:normal; stroke-linejoin:miter; font-size:12;
>>  stroke-dashoffset:0; image-rendering:auto;"
>>       xsi:schemaLocation="http://www.w3.org/1999/xlink "
>>       width="200"
>>       height="100">
>>      <text x="5" y="15" style="font-size:10; font-family:serif;
>>  stroke:none;" xml:space="preserve">Test matrix</text>
>>      <rect x="0" y="30" width="10000" height="70" fill="black"
>>  stroke="black" stroke-width="1"/>
>>      <g stroke="white">
>>          <line y2="50" style="fill:none;" x1="100" x2="400" y1="50">
>                <bt:hit>
>                    <bt:queryId>123123131232132</bt:queryId>
>                    <bt:queryString>AAAATGACGAGAGAGAGAGAGAGAG"></bt:queryString>
>                </bt:hit>
>>          </line>
>>      </g>
>>  </svg>
>>
>>  but it's failing to accept the XML as a valid SVG when using Batik's
>>  Java JSVGCanvas object. However, Mozilla firefox can view the image
>>  fine.
>>
>>  Can someone let me know what I'm doing wrong?
>
> The big problem is that with the DTD method you are adding new elements
> to the SVG namespace. When the viewer hits one, it has no idea how to
> render the new element.
>
> On the other hand, if the elements are in a different namespace, the
> viewer can safely ignore them. It can assume that those elements are
> meant for someone else to deal with.
>
> I've used this tactic before with some success. In fact, you can even
> access these elements through scripting, so they can contain
> information you use to modify the SVG further later.
>
> G. Wade
Received on Tuesday, 14 April 2009 12:18:18 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:42 GMT