hello,

I want to parse a svgDocument:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version:
6.00 Build 43363)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg";
xmlns:xlink="http://www.w3.org/1999/xlink"; x="0px" y="0px"
width="1024px" height="768px" viewBox="0 0 1024 768"
style="enable-background:new 0 0 1024 768;" xml:space="preserve">
<symbol  id="flag" viewBox="-37.416 -26.376 74.831 52.753">
<polygon style="fill:#39B54A;stroke:#93278F;stroke-width:6;"
points="34.416,-23.377 -34.416,-23.377 -34.416,23.377 34.416,23.377 "/>
</symbol>
<use xlink:href="#flag"  width="74.831" height="52.753" x="-37.416"
y="-26.376" transform="matrix(1 0 0 -1 215.6104 249.3247)"
style="overflow:visible;"/>
</svg>


I use this piece of code where sb contains the preceeding svg content

String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
try {
  Document d = f.createSVGDocument(uri, new StringReader(sb.toString()));
} catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
}
Node n= DOMUtilities.parseXML(sb.toString(),doc, uri,null, null, f);
return (Element) n.getFirstChild();


In the returned element I cannot find the viewBox element:

node.getAttribute(SVGConstants.SVG_VIEW_BOX_ATTRIBUTE).length()==0



What's happening?

thank's
-- 
Dao Hodac

Reply via email to