Re: is this switch valid?

On Sun, 09 Dec 2007 09:57:12 +0100, Jukka K. Korpela <jkorpela@cs.tut.fi>  
wrote:

>
> "~:'' ありがとうございました。" wrote:
>
>> the validator is barphing* on the attached SVG sample**.
>> some code has been removed to help identify the issue
>
> As usual in validation issues, the URL of the problem document should
> have been included.
>
>> * Line 26, Column 3: end tag for "switch" omitted, but OMITTAG NO was
>> specified.
>
> That's not the _first_ error message you get, is it? When I test your
> fragment (using the W3C validator's nice feature of specifying DOCTYPE
> interactively, and adding <svg> tags), I first get
>
> document type does not allow element "foreignObject" here; assuming
> missing "switch" start-tag.
>
> After this, it's no big surprise to get a message about missing end tag
> as well.
>
> I don't really know SVG, but neither need I know it to see that the
> markup
>
> <g  requiredExtensions="http://example.com/SVGExtensions/EmbeddedXHTML">
>      <foreignObject width="100" height="50">
>      </foreignObject>
> </g>
>
> is indeed invalid, since by the DTD, a <g> element may not have a
> <foreignObject> as its subelement ("child") - unless you're using DTD
> extensions. The <foreignObject> element is allowed as a subelement of a
> <switch> element only.

That sounds like a bug in the DTD for 1.1, and that's not how Opera or  
Firefox handles it.
In SVGT12 'foreignObject' can be a child of any container element, which  
is much more useful and I believe that is what Opera and Firefox allows.

Also note that it's fine to have a custom extension  
("http://example.com/SVGExtensions/EmbeddedXHTML"), but if viewers  
properly support the conditional processing in SVG they must ignore an  
element and its children if it doesn't understand the requiredExtension  
value. Not sure if there is a central registry for requiredExtensions  
anywhere, but Opera currently doesn't claim to support any particular  
extensions which means that the 'g' element (and its children) in the  
example above will not be displayed.

Cheers
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
http://my.opera.com/macdev_ed

Received on Monday, 10 December 2007 10:21:02 UTC