本文整理汇总了Java中org.xml.sax.helpers.ParserAdapter.parse方法的典型用法代码示例。如果您正苦于以下问题:Java ParserAdapter.parse方法的具体用法?Java ParserAdapter.parse怎么用?Java ParserAdapter.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.helpers.ParserAdapter
的用法示例。
在下文中一共展示了ParserAdapter.parse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CapabilitiesReader
import org.xml.sax.helpers.ParserAdapter; //导入方法依赖的package包/类
/** Construct a new instance of the reader and immediately parse the supplied inputStream.
*
* Use {@link #getTypeNames()} to retrieve the output.
*
* @param inputStream
* @throws SAXException
* @throws IOException
* @throws ParserConfigurationException
*/
public CapabilitiesReader(InputStream inputStream) throws SAXException, IOException, ParserConfigurationException {
InputStream dStream = decompressStream( inputStream );
//InputSource source = new InputSource( dStream );
// Set-up the SAX parser and source
SAXParser contextParser = SAXParserFactory.newInstance().newSAXParser();
contextAdapter = new ParserAdapter(contextParser.getParser());
contextAdapter.setContentHandler( this );
contextAdapter.parse( new InputSource( dStream ) );
}
示例2: parseXgmmlFile
import org.xml.sax.helpers.ParserAdapter; //导入方法依赖的package包/类
public Result parseXgmmlFile(File file, List<String> ids, Direction dir, DataSource ds) {
Result res = new Result();
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
ParserAdapter pa = new ParserAdapter(sp.getParser());
CyTargetLinkerParser parser = new CyTargetLinkerParser(ids, dir, ds);
pa.setContentHandler(parser);
pa.parse(new InputSource(new FileInputStream(file)));
res.setReginName(parser.getNetworkName());
res.setDir(dir);
if(parser.getNetworkAttr().containsKey("url")) {
res.setReginUrl(parser.getNetworkAttr().get("url"));
}
if(parser.getNetworkAttr().containsKey("type")) {
res.setReginType(parser.getNetworkAttr().get("type"));
}
res.getEdges().addAll(parser.getEdgeList());
parser.clean();
} catch(Exception e) {
e.printStackTrace();
}
return res;
}
示例3: parse
import org.xml.sax.helpers.ParserAdapter; //导入方法依赖的package包/类
public void parse(DefaultHandler handler) throws IOException, SAXException {
SAXParser sp = createSaxParser();
ParserAdapter pa = new ParserAdapter(sp.getParser());
pa.setContentHandler(handler);
pa.parse(new InputSource(reader));
}