Re: SVG use element and cycles

Hi Chad,

	Yes it's allowed.

	The spec clearly states that the cycles need to be detected and
there are tests in the test suite to validate that the implementation does
not go into infinite loops.

	For example, struct-use-recursion-01-t.svg, etc.

Alex

--Original Message--:
>In SVG, the <use> element can be used to create a cycle by linking to a parent node.  Is this allowed?  How should it be handled?
>
>For example, here is a specific test case that is giving me some trouble.
>
><svg xmlns="http://www.w2.org/2000/svg">
><g id="foo">
><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xl="http://w3.org/1999/xlink">
><use xl:href="#foo"/>
><g id="bar" />
><use xlink:href="#bar"/>
>
>
>[ Note that the first <g> tag is a start-tag, and not an empty-tag ]
>
>First of all, it is not well formed xml, so that's perhaps reason enough to reject it.  But even if it were well-formed XML the structure of it is strange -- I have a problem with the idea of having a <use> element refer to its own grandparent element.  This would case a cycle in my mind, and should probably be disallowed.
>
>What does the spec have to say about the validity of this, and specifically the potential cycles that would be created by having a <use> element refer to one of its ancestor nodes?
>
>- Chad
>
>
>
>

Received on Thursday, 18 March 2010 09:13:29 UTC