⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xgmmlreader.java

📁 OpenJGraph是一个开源的Java库
💻 JAVA
字号:
package salvo.jesus.graph.xml;import java.io.*;import org.xml.sax.*;import org.xml.sax.helpers.*;import salvo.jesus.graph.*;/** * This class is responsible for parsing an XGMML input using SAX2 and * returning a Graph instance. An implementation of <tt>ContentHandler</tt>, * <tt>XGMMLLContentHandler</tt> is used to process SAX events. * * @author  Jesus M. Salvo Jr. */public class XGMMLReader {    private InputSource     source;    private EntityResolver  resolver;    private XGMMLContentHandler handler;    public XGMMLReader( InputStream in, XGMMLContentHandler handler ) {        this.source = new InputSource( in );        this.handler = handler;    }    public XGMMLReader( Reader reader, XGMMLContentHandler handler ) {        this.source = new InputSource( reader );        this.handler = handler;    }    public Graph parse() throws IOException, SAXException {        XMLReader   reader = XMLReaderFactory.createXMLReader( "org.apache.xerces.parsers.SAXParser" );        resolver = new DTDResolver();        reader.setContentHandler( this.handler );        reader.setEntityResolver( resolver );        reader.parse( source );        return handler.getGraph();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -