本文整理汇总了Java中org.dom4j.io.SAXReader.setFeature方法的典型用法代码示例。如果您正苦于以下问题:Java SAXReader.setFeature方法的具体用法?Java SAXReader.setFeature怎么用?Java SAXReader.setFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dom4j.io.SAXReader
的用法示例。
在下文中一共展示了SAXReader.setFeature方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseText
import org.dom4j.io.SAXReader; //导入方法依赖的package包/类
public static Document parseText(String text) throws DocumentException, SAXException {
SAXReader reader = new SAXReader(false);
reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
reader.setFeature("http://apache.org/xml/features/validation/schema", false);
String encoding = getEncoding(text);
InputSource source = new InputSource(new StringReader(text));
source.setEncoding(encoding);
Document result = reader.read(source);
// if the XML parser doesn't provide a way to retrieve the encoding,
// specify it manually
if (result.getXMLEncoding() == null) {
result.setXMLEncoding(encoding);
}
return result;
}
示例2: setValidationFor
import org.dom4j.io.SAXReader; //导入方法依赖的package包/类
private void setValidationFor(SAXReader saxReader, String xsd) {
try {
saxReader.setFeature( "http://apache.org/xml/features/validation/schema", true );
// saxReader.setFeature( "http://apache.org/xml/features/validation/dynamic", true );
if ( "orm_2_1.xsd".equals( xsd ) ) {
saxReader.setProperty(
"http://apache.org/xml/properties/schema/external-schemaLocation",
"http://xmlns.jcp.org/xml/ns/persistence/orm " + xsd
);
}
else {
saxReader.setProperty(
"http://apache.org/xml/properties/schema/external-schemaLocation",
"http://java.sun.com/xml/ns/persistence/orm " + xsd
);
}
}
catch ( SAXException e ) {
saxReader.setValidation( false );
}
}
示例3: DoubleVarcharSizes
import org.dom4j.io.SAXReader; //导入方法依赖的package包/类
public DoubleVarcharSizes() throws DocumentException, SAXException {
iSAXReader = new SAXReader();
iSAXReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
}
示例4: LowercaseTableNames
import org.dom4j.io.SAXReader; //导入方法依赖的package包/类
public LowercaseTableNames() throws DocumentException, SAXException {
iSAXReader = new SAXReader();
iSAXReader.setEntityResolver(iEntityResolver);
iSAXReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
}