001: /*
002: * Copyright 1999-2004 The Apache Software Foundation
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.apache.commons.jxpath.xml;
017:
018: import java.io.InputStream;
019:
020: /**
021: * The abstract superclass of XML parsers that produce DOM Documents.
022: * The features have the same defaults as DocumentBuilderFactory.
023: *
024: * @author Dmitri Plotnikov
025: * @version $Revision: 1.3 $ $Date: 2004/02/29 14:17:37 $
026: */
027: public abstract class XMLParser2 implements XMLParser {
028: private boolean validating = false;
029: private boolean namespaceAware = true;
030: private boolean whitespace = false;
031: private boolean expandEntityRef = true;
032: private boolean ignoreComments = false;
033: private boolean coalescing = false;
034:
035: /**
036: * @see DocumentBuilderFactory#setValidating(boolean)
037: */
038: public void setValidating(boolean validating) {
039: this .validating = validating;
040: }
041:
042: /**
043: * @see DocumentBuilderFactory#isValidating()
044: */
045: public boolean isValidating() {
046: return validating;
047: }
048:
049: /**
050: * @see DocumentBuilderFactory#isNamespaceAware()
051: */
052: public boolean isNamespaceAware() {
053: return namespaceAware;
054: }
055:
056: /**
057: * @see DocumentBuilderFactory#setNamespaceAware(boolean)
058: */
059: public void setNamespaceAware(boolean namespaceAware) {
060: this .namespaceAware = namespaceAware;
061: }
062:
063: /**
064: * @see DocumentBuilderFactory#setIgnoringElementContentWhitespace(boolean)
065: */
066: public void setIgnoringElementContentWhitespace(boolean whitespace) {
067: this .whitespace = whitespace;
068: }
069:
070: /**
071: * @see DocumentBuilderFactory#isIgnoringElementContentWhitespace()
072: */
073: public boolean isIgnoringElementContentWhitespace() {
074: return whitespace;
075: }
076:
077: /**
078: * @see DocumentBuilderFactory#isExpandEntityReferences()
079: */
080: public boolean isExpandEntityReferences() {
081: return expandEntityRef;
082: }
083:
084: /**
085: * @see DocumentBuilderFactory#setExpandEntityReferences(boolean)
086: */
087: public void setExpandEntityReferences(boolean expandEntityRef) {
088: this .expandEntityRef = expandEntityRef;
089: }
090:
091: /**
092: * @see DocumentBuilderFactory#isIgnoringComments()
093: */
094: public boolean isIgnoringComments() {
095: return ignoreComments;
096: }
097:
098: /**
099: * @see DocumentBuilderFactory#setIgnoringComments(boolean)
100: */
101: public void setIgnoringComments(boolean ignoreComments) {
102: this .ignoreComments = ignoreComments;
103: }
104:
105: /**
106: * @see DocumentBuilderFactory#isCoalescing()
107: */
108: public boolean isCoalescing() {
109: return coalescing;
110: }
111:
112: /**
113: * @see DocumentBuilderFactory#setCoalescing(boolean)
114: */
115: public void setCoalescing(boolean coalescing) {
116: this .coalescing = coalescing;
117: }
118:
119: public abstract Object parseXML(InputStream stream);
120: }
|