Java API 用于 RDL(.rdl) 文件
Java API for RDL(.rdl) files
我有一些 .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);
}
}
这只是使用 DOM parser and prints out the value of the root node. Take a look at parsing XML with DOM and SAX 解析方法解析文件。
我有一些 .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);
}
}
这只是使用 DOM parser and prints out the value of the root node. Take a look at parsing XML with DOM and SAX 解析方法解析文件。