xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arian Hojat <armyofda12mnk...@gmail.com>
Subject SVG Xlink:href element within a Document
Date Mon, 04 Apr 2005 06:10:05 GMT
hey i ran into trouble bringing an image in with SVG in Batik...
I guess this is a more DOM question using SVG in Batik, but if anyone
can help thanx!...
I try to use this code but it does not work. not sure how to approach it


Document svgDoc;
        
        DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
        svgDoc =
impl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg",
null);
        Element svgRoot = svgDoc.getDocumentElement();
        svgRoot.setAttributeNS(null, "width", "800");
        svgRoot.setAttributeNS(null, "height", "600");
        svgRoot.setAttributeNS(null, "xmlns:xlink",
"http://www.w3.org/1999/xlink");//xMidYMid meet
        
        Element image1 =
svgDoc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI,
"image");
        image1.setAttributeNS(null, "xlink:href", "a.jpg");   
        image1.setAttributeNS(null, "x", "0");
        image1.setAttributeNS(null, "y", "0");
        image1.setAttributeNS(null, "width", "100%");
        image1.setAttributeNS(null, "height","100%");
       

        svgRoot.appendChild(image1);

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


Mime
View raw message