You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by rehan shaikh <fr...@yahoo.com> on 2003/05/23 16:52:40 UTC

How to remove xlink:actuate="onRequest" and xlink:show="replace" generated automatically (Rehan)

Hi 
    I am generating an SVG using Batik. I have a
reference to a jpeg file. The code below adds the
reference to the file:

Element image = doc.createElementNS(svgNS, "image");
        String xlinkNS =
"http://www.w3.org/1999/xlink";
        image.setAttributeNS(xlinkNS, "xlink:href",
"file://C:/delete/documentex2.jpg");
        image.setAttributeNS(null, "x", "0");
        image.setAttributeNS(null, "y", "0");
        image.setAttributeNS(null, "width", "628");
        image.setAttributeNS(null, "height", "800");
        root.appendChild(image);

The problem is that when the new svg file is
generated, there are links like  xlink:show="replace"
and xlink:actuate="onRequest" which are undesirable as
they give me an error message in my svg viewer XML
spy. The message is:
This file is not valid. Unexpected choice 'onRequest'
for attribute 'xlink:actuate': (onLoad) expected.
How can I avoid the addition of these attributes by
Batik?

thanks and regards
Rehan

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

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


RE: How to remove xlink:actuate="onRequest" and xlink:show="replace" generated automatically (Rehan)

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "rs" == rehan shaikh <fr...@yahoo.com> writes:

rs> Hi I am generating an SVG using Batik. I have a reference to a
rs> jpeg file. The code below adds the reference to the file:

[...]

rs> The problem is that when the new svg file is generated, there are
rs> links like xlink:show="replace" and xlink:actuate="onRequest"
rs> which are undesirable as they give me an error message in my svg
rs> viewer XML spy. 

    If you look at 'Appendix M' of the SVG specification you will see
that these are Fixed attributes - thus the Batik DOM 'hard codes' them
into the lements.


rs> The message is: This file is not valid. Unexpected choice
rs> 'onRequest' for attribute 'xlink:actuate': (onLoad) expected.  

    This appears to be a bug in the Batik SVG DOM: 'onRequest' is
correct for the SVGOMAElement but is wrong for all the other xlink
elements (image, use, altGlyph... - see batik.dom.svg.SVGOM*).  If we
fix this bug in Batik it will 'solve' your problem (XML Spy will be
happy and the document should be valid).

rs> How can I avoid the addition of these attributes by Batik?

    I don't think you can (this is one small example of why going from
an infoset to a 'good' xml file is _really_ hard).  You can try
'stripping' them out - but I don't think the write methods currently
have hooks to enable this (contributions are always welcome :).


rs> thanks and regards Rehan

    Sorry I couldn't be more helpful than this.


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