You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Jeremias Maerki <de...@jeremias-maerki.ch> on 2011/03/04 14:48:46 UTC

Fragment checking in IRI on svg:image/@xlink:href

Is there a reason why org.apache.batik.bridge.SVGImageElementBridge.buildImageGraphicsNode(BridgeContext, Element)
disallows IRI references with a fragment?

In the 1.1 spec I can read: "Unlike ‘use’, the ‘image’ element cannot
reference elements within an SVG file."

I read that so that you cannot have a local reference like "#my-frag",
but something like "myscheme:test/pages.tif#2" should be allowed, right
(provided I have a suitable protocol handler)?

Personally, I'm inclined to change:

        if (uriStr.indexOf('#') != -1) {
            throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
                                      new Object[] {"xlink:href", uriStr});
        }

to:

        if (uriStr.startsWith("#")) {
            throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
                                      new Object[] {"xlink:href", uriStr});
        }

Anything speaking against that?

Thanks,
Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: Fragment checking in IRI on svg:image/@xlink:href

Posted by Cameron McCormack <ca...@mcc.id.au>.
Jeremias Maerki:
> Personally, I'm inclined to change:
> 
>         if (uriStr.indexOf('#') != -1) {
>             throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
>                                       new Object[] {"xlink:href", uriStr});
>         }
> 
> to:
> 
>         if (uriStr.startsWith("#")) {
>             throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
>                                       new Object[] {"xlink:href", uriStr});
>         }
> 
> Anything speaking against that?

I imagine that SVG view specifications in the fragment should be
honoured when referencing an SVG file from an <image>, anyway.  Throwing
an exception solely on the presence of a "#" seems wrong.  Having <image
xlink:href="something.svg#foo"> where foo is the ID of a graphic
elements should render the whole something.svg document, as if the
fragment wasn’t there, I think.

Also, in the presence of xml:base="", even <image xlink:href="#foo">
could be valid.

-- 
Cameron McCormack ≝ http://mcc.id.au/

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org