Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xmlgraphics-batik Wiki" 
for change notification.

The "BuildAndParse" page has been changed by drool:
http://wiki.apache.org/xmlgraphics-batik/BuildAndParse?action=diff&rev1=5&rev2=6

Comment:
display java code with syntax highlighting

  
  The first task is to create the document:
  
- {{{
+ {{{#!java
  String parser = XMLResourceDescriptor.getXMLParserClassName();
  SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
  URI uri; // the URI of your SVG document
@@ -15, +15 @@

  
  Then you want Batik to build the DOM for you (see BootSvgAndCssDom)
  
- {{{
+ {{{#!java
  UserAgent      userAgent;
  DocumentLoader loader;
  BridgeContext  ctx;
@@ -32, +32 @@

  
  From now on, you can ask for a SVGOMSVGElement from the Document, and you can 
call for getComputedStyle:
  
- {{{
+ {{{#!java
  SVGOMSVGElement myRootSVGElement = (SVGOMSVGElement) doc.getDocumentElement();
  
  //I want all the "path" elements for example
@@ -47, +47 @@

        //If I want to parse the "d" attribute
        String toParse = elt.getAttribute("d");
        //This string can then be fed to a PathParser if you want to create the 
shapes yourself
+ }
  }}}
  

Reply via email to