- * ドキュメントビルダファクトリを初期化する。
- * @param builderFactory ドキュメントビルダファクトリ
- */
- private static void initBuilderFactory(
- DocumentBuilderFactory builderFactory ){
- builderFactory.setCoalescing(true);
- builderFactory.setExpandEntityReferences(true);
- builderFactory.setIgnoringComments(true);
- builderFactory.setIgnoringElementContentWhitespace(false);
- builderFactory.setNamespaceAware(true);
- builderFactory.setValidating(false);
- builderFactory.setXIncludeAware(false);
-
-// builderFactory.setFeature(name, value);
-// builderFactory.setAttribute(name, value);
-
- return;
- }
-
- /**
- * DOMビルダ生成。
- * @return DOMビルダ
- */
- private DocumentBuilder buildBuilder(){
- XmlResourceResolver resolver = new XmlResourceResolver();
-
- LocalXmlResource[] schemaArray;
- switch(this.inTypes){
- case XML_101009:
- schemaArray = new LocalXmlResource[]{
- Schema101009.SINGLETON,
- };
- break;
- case XML_130128:
- schemaArray = new LocalXmlResource[]{
- Schema130128.SINGLETON,
- };
- break;
- case XML_AUTO:
- schemaArray = new LocalXmlResource[]{
- Schema101009.SINGLETON,
- Schema130128.SINGLETON,
- };
- break;
- default:
- throw new IllegalStateException();
- }
-
- Schema schema = SchemaUtil.newSchema(resolver, schemaArray);
-
- DocumentBuilderFactory builderFactory =
- DocumentBuilderFactory.newInstance();
- initBuilderFactory(builderFactory);
- builderFactory.setSchema(schema);
-
- DocumentBuilder result;
- try{
- result = builderFactory.newDocumentBuilder();
- }catch(ParserConfigurationException e){
- assert false;
- throw new AssertionError(e);
- }
- result.setEntityResolver(resolver);
- result.setErrorHandler(BotherHandler.HANDLER);
-
- return result;
- }
-
-
- /**