# Package com.mxgraph.reader

This package contains the classes required to turn an encoded mxGraphView into an image using SAX and without having to create a graph model.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  mxDomOutputParser.IElementHandler |
  mxSaxOutputHandler.IElementHandler |

- Class Summary
  Class | Description
  --- | ---
  mxDomOutputParser | public static void main(String[] args) { try { String filename = Test.class.getResource( "/com/mxgraph/online/exported.xml").getPath(); String xml = mxUtils.readFile(filename); System.out.println("xml=" + xml); Document doc = mxUtils.parseXml(xml); Element root = doc.getDocumentElement(); int width = Integer.parseInt(root.getAttribute("width")); int height = Integer.parseInt(root.getAttribute("height")); System.out.println("width=" + width + " height=" + height); BufferedImage img = mxUtils.createBufferedImage(width, height, Color.WHITE); Graphics2D g2 = img.createGraphics(); mxUtils.setAntiAlias(g2, true, true); mxDomOutputParser reader = new mxDomOutputParser( new mxGraphicsExportCanvas(g2)); reader.read((Element) root.getFirstChild().getNextSibling()); ImageIO.write(img, "PNG", new File( "C:\\Users\\Gaudenz\\Desktop\\test.png")); } catch (Exception e) { e.printStackTrace(); } } // ------------- Document doc = mxUtils.parseXml(xml); Element root = doc.getDocumentElement(); mxDomOutputParser reader = new mxDomOutputParser(canvas); reader.read(root.getFirstChild());
  mxGraphViewImageReader | A converter that renders display XML data onto a graphics canvas.
  mxGraphViewReader | An abstract converter that renders display XML data onto a canvas.
  mxSaxOutputHandler | XMLReader reader = SAXParserFactory.newInstance().newSAXParser() .getXMLReader(); reader.setContentHandler(new mxSaxExportHandler( new mxGraphicsExportCanvas(g2))); reader.parse(new InputSource(new StringReader(xml)));

## Package com.mxgraph.reader Description

This package contains the classes required to turn an encoded mxGraphView into an image using SAX and without having to create a graph model.

Copyright (c) 2010 Gaudenz Alder. All rights reserved.