@Test
public void testDefaultAttrNS() {
XMLInputFactory ifac = XMLInputFactory.newInstance();
try {
XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
this.getClass().getResourceAsStream(INPUT_FILE1));
while (re.hasNext()) {
int event = re.next();
if (event == XMLStreamConstants.START_ELEMENT) {
// System.out.println("#attrs = " + re.getAttributeCount());
Assert.assertTrue(re.getAttributeCount() == 2);
// This works if "" is replaced by null too
// System.out.println("attr1 = " + re.getAttributeValue("",
// "attr1"));
Assert.assertTrue(re.getAttributeValue("", "attr1").equals("pass"));
}
}
re.close();
} catch (Exception e) {
e.printStackTrace();
Assert.fail("Exception occured: " + e.getMessage());
}
}
Jsr173MR1Req8Test.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录