0

I try to examine uploaded SVG graphics and look for image elements to read there href attribute. I am using Batik 1.7 to search for corresponding elements. By using 'getElementsByTagName' / 'getElementsByTagNameNS' I only get an empty list. Here is my code:

try{
    String parser = XMLResourceDescriptor.getXMLParserClassName();
    SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
    SVGDocument doc = f.createSVGDocument(null, upload.getInputStream());
    NodeList list = doc.getElementsByTagNameNS("http://www.w3.org/2000/svg", "image");
}
catch(Exception e){
}

So what I am missing here?

StarsSky
  • 6,630
  • 6
  • 36
  • 62
Franatique
  • 75
  • 1
  • 4

1 Answers1

0

In fact I was missing nothing, despite the fact that the returned NodeList will be market with length -1 as long as some item is retrieved or the length is queried. So one could say the debugger not always tells the truth.

Franatique
  • 75
  • 1
  • 4