【发布时间】:2016-01-07 11:24:49
【问题描述】:
我有一些 .rdl 文件。我想是否有任何特定的 java API 可以解析。我在互联网上搜索但找不到。
请提出建议。
【问题讨论】:
我有一些 .rdl 文件。我想是否有任何特定的 java API 可以解析。我在互联网上搜索但找不到。
请提出建议。
【问题讨论】:
这取决于您想对 .RDL 文件做什么。如果您有兴趣解析内容然后对结果执行您自己的操作,那么您可以将其视为标准 XML。例如:
private void parseRdlFile(String filePath) {
File rdlFile = new File(filePath);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder;
Document doc;
try {
dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(rdlFile);
System.out.println("Root:" + doc.getDocumentElement().getNodeName());
} catch (SAXException | IOException | ParserConfigurationException e) {
LOG.error("Error parsing", e);
}
}
【讨论】: