xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gold Martin <Martin.G...@blva.bayern.de>
Subject error with attribute 'xlink:href' when loading a raster image
Date Tue, 14 Oct 2003 16:58:50 GMT

I have written an Interactor to load raster images into the canvas.
When I click into the SVG-Canvas to load the raster image I get the
following error message:
The attribute 'xlink:href' of the element <image> is required

The header of my SVG-file looks like this:
<?xml version='1.0' standalone='no'?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 20001102//EN'
<svg contentScriptType="text/ecmascript" width="700"
     xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
     contentStyleType="text/css" viewBox="4280000 -5620000 350000 400000"
     height="700" preserveAspectRatio="xMidYMid meet"
     xmlns="http://www.w3.org/2000/svg" version="1.0">

The code in the update queue of my interactor to show the raster image looks
like that:
    public void mousePressed(MouseEvent e) {
        final JSVGCanvas svgCanvas = (JSVGCanvas) e.getSource();          
        beendet = true;
        if ((e.getModifiers() & java.awt.event.InputEvent.BUTTON1_MASK) !=
            try {
            new Runnable() {
               public void run() {
                  final Document document = svgCanvas.getSVGDocument();
                  final Element svgRoot = document.getDocumentElement();
                  final String svgNS =
                  Element gruppe = document.createElementNS(svgNS, "g"); 
                  gruppe.setAttributeNS(null, "id", svgCanvas.RASTER_ID);
                  gruppe.setAttributeNS(null, "transform", new String
                  gruppe.setAttributeNS(null, "visibility", "visible");
                  Element image = document.createElementNS(svgNS, "image"); 
                  image.setAttributeNS(null, "xlink:href",
                  image.setAttributeNS(null, "x", new String ("0"));
                  image.setAttributeNS(null, "y", new String ("0"));
                  image.setAttributeNS(null, "width", "28117.8");
                  image.setAttributeNS(null, "height","26035.0");    
            } catch (Exception ex) {

You can see the xlink namespace in my document is declared.
So why do I get this error message ?
What I'm doing wrong ?

Best regards and thanks for your help,

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

View raw message