AttributesTest.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
/**
 * Unit test for Attributes interface. Prints all attributes into output
 * file. Check it with golden file.
 *
 * @throws Exception If any errors occur.
 */
@Test
public void testcase01() throws Exception {
    String outputFile = USER_DIR + "Attributes.out";
    String goldFile = GOLDEN_DIR + "AttributesGF.out";
    String xmlFile = XML_DIR + "family.xml";

    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);
    spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
                                true);
    spf.setValidating(true);
    SAXParser saxParser = spf.newSAXParser();
    MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
    saxParser.parse(new File(xmlFile), myAttrCHandler);
    myAttrCHandler.flushAndClose();
    assertTrue(compareWithGold(goldFile, outputFile));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号