001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package com.caucho.xml2;
031:
032: import com.caucho.xml.QName;
033:
034: import org.xml.sax.*;
035:
036: import java.io.IOException;
037: import java.util.Locale;
038:
039: /**
040: * A fast XML parser.
041: */
042: public class XMLParserImpl implements Parser {
043: // Xerces uses the following
044: public static final String XMLNS = "http://www.w3.org/2000/xmlns/";
045:
046: static final QName DOC_NAME = new QName(null, "#document", null);
047: static final QName TEXT_NAME = new QName(null, "#text", null);
048: static final QName JSP_NAME = new QName(null, "#jsp", null);
049: static final QName WHITESPACE_NAME = new QName(null, "#whitespace",
050: null);
051: static final QName JSP_ATTRIBUTE_NAME = new QName("xtp",
052: "jsp-attribute", null);
053:
054: private EntityResolver _entityResolver;
055: private ErrorHandler _errorHandler;
056: private DocumentHandler _documentHandler;
057: private DTDHandler _dtdHandler;
058: private Locale _locale;
059:
060: /**
061: * Sets the SAX errorHandler.
062: *
063: * @param handler the error handler
064: */
065: public void setErrorHandler(ErrorHandler handler) {
066: _errorHandler = handler;
067: }
068:
069: /**
070: * Sets the SAX entityResolver.
071: *
072: * @param resolver the entity resolver
073: */
074: public void setEntityResolver(EntityResolver resolver) {
075: _entityResolver = resolver;
076: }
077:
078: /**
079: * Sets the SAX document handler
080: *
081: * @param handler the document handler
082: */
083: public void setDocumentHandler(DocumentHandler handler) {
084: _documentHandler = handler;
085: }
086:
087: /**
088: * Sets the SAX DTD handler
089: *
090: * @param handler the dtd handler
091: */
092: public void setDTDHandler(DTDHandler handler) {
093: _dtdHandler = handler;
094: }
095:
096: /**
097: * Sets the SAX locale
098: *
099: * @param locale locale
100: */
101: public void setLocale(Locale locale) {
102: _locale = locale;
103: }
104:
105: /**
106: * parses the input source.
107: *
108: * @param source the source to parse from
109: */
110: public void parse(InputSource source) throws IOException,
111: SAXException {
112:
113: }
114:
115: /**
116: * parses the file at the given string
117: *
118: * @param url the source url to parse from
119: */
120: public void parse(String source) throws IOException, SAXException {
121:
122: }
123: }
|