xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Chetwynd <j.chetw...@btinternet.com>
Subject Re: Attrbutes Generated For USE tag
Date Mon, 07 Apr 2008 09:43:37 GMT
Dylan,

basically no,
as a minimum you definitely need the xlink:href
href is not part of svg which is why you are defining xlink in the  
root and then referencing that definition.

cheers

~:"

On 7 Apr 2008, at 10:31, Dylan Browne wrote:

> Hi all,
>
> I have a question about the attributes that are added into my  
> “use” tag when I generate it. Basically I am attempting to  
> ‘streamline’ my SVG to reduce file size, so any attributes that  
> are not required I’d like to strip out.
>
> My code looks like this…
>
> Element plotCh =  
> doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI,  
> SVG12Constants.SVG_USE_TAG);
>                     
> plotCh.setAttributeNS(XMLConstants.XLINK_NAMESPACE_URI,  
> "xlink:href", "#" + type);
>                    plotCh.setAttributeNS(null,  
> SVG12Constants.SVG_TRANSFORM_ATTRIBUTE, "translate(" + x + "," + y +  
> ")" +"scale(" + scale + ")");
>
> The resultant SVG looks like this:
>
> <use  
> transform="translate(74.57333333333332,96.58609675667977)scale(5.0)"  
> xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#circle"  
> xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed">
>
> I was wondering if there was a way I could remove the inclusion of  
> the xlink namespace etc, as these are defined in the root of my SVG  
> document?
>
> I’ve tried doing a removeAttributeNS but either this is not  
> possible or I am attempting to reference them by the wrong  
> namespace. I’ve tried variations on something like this:
>
> plotCh.removeAttributeNS(XMLConstants.XLINK_NAMESPACE_URI,  
> "xlink:show");
>
> PS This is topic I raised many moons ago, and kindly received some  
> tips from Thomas. For reference:
>
> http://www.nabble.com/Displaying-JPEG-file-in-SVG-in-batik-td4988720.html#a5430782
>
> Thanks in advance as always,
>
> Dylan
>
>
> mangosolutions
>   Tel   +44 (0)1249 767700
>   Mob/Cell +44 (0)7720 897180
>   Fax  +44 (0)1249 767707
> Mango have moved - our new address is Ground Floor, Unit 2 Greenways  
> Business Park, Chippenham SN15 1BN
>


Jonathan Chetwynd

j.chetwynd@btinternet.com
http://www.iconomy.org/

+44 (0) 20 7978 1764



Mime
View raw message