I have an RDF document that contains an "svg node", i.e. information suitable to be displayed on a JSVGCanvas:
I have developed an application that creates an empty SVGDocument, parses the RDF file, extracts the "svg node" from it and appends it to the SVGDocument.
The SVGDocument I obtain this way is correct, but when I call JSVGCanvas.setSVGDocument(svgDoc) it is not displayed.
(NB: I set my JSVGcanvas ALWAYS DYNAMIC)
Here is a fragment of my code:
public void showSvg(){
JSVGCanvas svgCanvas;
parserDom = new DOMParser();
DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
SVGDOMImplementation svgImpl = (SVGDOMImplementation) SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
........
try{
parserDom.parse(fileRDF.toURL().toString());
doc = parserDom.getDocument(); }
catch(SAXException e){
System.out.println("The file is not well formed");
}
catch(IOException e){
System.out.println("errore di IO nella lettura del file
rdf");
}
tempDoc = impl.createDocument(svgNS,"svg",null);
//***parse the RDF***
DocumentTraversal trav = (DocumentTraversal)doc;
NodeIterator ni = trav.createNodeIterator(
doc.getDocumentElement(),
NodeFilter.SHOW_ELEMENT,
this,
true);
dummyRoot = tempDoc.getDocumentElement();
while(((node = ni.nextNode())!= null)){
Node importedNode = tempDoc.importNode(node, true);
dummyRoot.appendChild(importedNode);
System.out.println("ho fatto l'append!!!");
}
svgDoc = (SVGDocument)tempDoc;
svgCanvas.setDocument(svgDoc); //this doesn't work
/////*******Nodes Filtering*******/////////
public short acceptNode(Node node){
if(node.getNodeName().equals("g"))
return FILTER_ACCEPT;
else return FILTER_SKIP;
}
}
Here is the rdf document: <?xml version="1.0" encoding="UTF-8"?> <web:RDF xmlns:web="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" xmlns:comed="schema#" >
<Record web:about="radiografia-1" comed:name="documentoanalisi.doc">
<comed:content>
<svg width="475" height="387" xmlns:xlink="http://www.w3.org/1999/xlink" >
<g visibility ="visible" id="xray">
<image x="0" y="0" width="475" height="387" xlink:href="xray.jpg"/>
</g>
</svg>
</comed:content>
<comed:comments>
<comed:note web:about="commento-1_2" comed:name="Dr. Livingstone"/>
<comed:note web:about="commento-1_1" comed:name="Dr. Stranamore"/>
</comed:comments>
</Record></web:RDF>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
