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