Hi,

I have stumbled across this before. SVG 1.2 requires that if there is an SVG id attribute, there must also be a corresponding id attribute in the XML namespace. However, what Batik does is this: If an SVG id attribute is set, it automatically sets an id attribute in the XML namespace - however, when calling the setAttributeNS method, it uses the local name for the id attribute instead of the qualified name (see AbstractElement and SVGOMElement).

The correct output of Paul's example would be:

<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd' > <svg xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink " version="1.2">
        <g id="test" xml:id="test"><text>ANY CONTENT</text></g>
</svg>

This can be achieved by passing the qualified name for the XML id attribute ("xml:id") to the setAttributeNS method instead of the local name.

With the current implementation of Batik, it is impossible to parse a serialized SVG 1.2 document containing id attributes, because the parser will complain about the duplicate id attribute.

Best regards,

Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to