本文整理汇总了Java中javax.xml.validation.ValidatorHandler.getFeature方法的典型用法代码示例。如果您正苦于以下问题:Java ValidatorHandler.getFeature方法的具体用法?Java ValidatorHandler.getFeature怎么用?Java ValidatorHandler.getFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.validation.ValidatorHandler
的用法示例。
在下文中一共展示了ValidatorHandler.getFeature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test1
import javax.xml.validation.ValidatorHandler; //导入方法依赖的package包/类
@Test
public void test1() throws Exception {
SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
try {
validatorHandler.getFeature("unknown1234");
Assert.fail("SAXNotRecognizedException was not thrown.");
} catch (SAXNotRecognizedException e) {
; // expected
}
if (!validatorHandler.getFeature("http://xml.org/sax/features/namespace-prefixes")) {
// as expected
System.out.println("getFeature(namespace-prefixes): OK");
} else {
Assert.fail("Expected false, returned true.");
}
}
示例2: test1
import javax.xml.validation.ValidatorHandler; //导入方法依赖的package包/类
@Test
public void test1() throws Exception {
SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
try {
validatorHandler.getFeature(null);
Assert.fail();
} catch (NullPointerException e) {
e.printStackTrace();
; // as expected
}
}
示例3: testGetNullFeature
import javax.xml.validation.ValidatorHandler; //导入方法依赖的package包/类
@Test(expectedExceptions = NullPointerException.class)
public void testGetNullFeature() throws SAXNotRecognizedException, SAXNotSupportedException {
ValidatorHandler validatorHandler = getValidatorHandler();
assertNotNull(validatorHandler);
validatorHandler.getFeature(null);
}