private BeansXml readBeansXml(BeanArchive beanArchive, ClasspathResource resource) {
try {
final SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
factory.setNamespaceAware(true);
final SAXParser parser = factory.newSAXParser();
final InputSource source = new InputSource(new ByteArrayInputStream(resource.getBytes()));
if (source.getByteStream().available() == 0) {
// The file is just acting as a marker file
return EMPTY_BEANS_XML;
}
final BeansXmlHandler handler = new BeansXmlHandler(beanArchive.getClasspathEntry().getURL());
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", loadXsds());
parser.parse(source, handler);
return handler.createBeansXml();
} catch (final SAXException | ParserConfigurationException | IOException e) {
throw new TestEEfiException(
"Failed to parse META-INF/beans.xml in " + beanArchive.getClasspathEntry().getURL(),
e
);
}
}
BeanDeploymentArchiveImpl.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:testee.fi
作者:
评论列表
文章目录