01: /*
02: ItsNat Java Web Application Framework
03: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
04: Author: Jose Maria Arranz Santamaria
05:
06: This program is free software: you can redistribute it and/or modify
07: it under the terms of the GNU Affero General Public License as published by
08: the Free Software Foundation, either version 3 of the License, or
09: (at your option) any later version. See the GNU Affero General Public
10: License for more details. See the copy of the GNU Affero General Public License
11: included in this program. If not, see <http://www.gnu.org/licenses/>.
12: */
13:
14: package org.itsnat.impl.core.dom.parse;
15:
16: import org.itsnat.core.ItsNatException;
17: import org.apache.xerces.parsers.DOMParser;
18: import org.xml.sax.SAXNotRecognizedException;
19: import org.xml.sax.SAXNotSupportedException;
20:
21: /**
22: *
23: * @author jmarranz
24: */
25: public class XercesXMLParser extends ItsNatDOMParser {
26:
27: /**
28: * Creates a new instance of XercesXMLParser
29: */
30: public XercesXMLParser() {
31: try {
32: parser
33: .setFeature(NAMESPACES_FEATURE_ID,
34: DEFAULT_NAMESPACES);
35: parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID,
36: DEFAULT_SCHEMA_VALIDATION);
37: parser.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID,
38: DEFAULT_SCHEMA_FULL_CHECKING);
39: parser.setFeature(DYNAMIC_VALIDATION_FEATURE_ID,
40: DEFAULT_DYNAMIC_VALIDATION);
41:
42: parser.setFeature(DEFAULT_LOAD_DTD_GRAMMAR_ID,
43: DEFAULT_LOAD_DTD_GRAMMAR);
44: parser.setFeature(DEFAULT_LOAD_EXTERNAL_DTD_ID,
45: DEFAULT_LOAD_EXTERNAL_DTD);
46: } catch (SAXNotRecognizedException ex) {
47: throw new ItsNatException(ex);
48: } catch (SAXNotSupportedException ex) {
49: throw new ItsNatException(ex);
50: }
51: }
52:
53: public DOMParser createParser() {
54: return new org.apache.xerces.parsers.DOMParser();
55: }
56: }
|