< prev index next >

src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderAdapter.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 // XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser
  27 // http://www.saxproject.org
  28 // Written by David Megginson
  29 // NO WARRANTY!  This class is in the public domain.
  30 // $Id: XMLReaderAdapter.java,v 1.3 2004/11/03 22:53:09 jsuttor Exp $
  31 
  32 package org.xml.sax.helpers;
  33 
  34 import java.io.IOException;
  35 import java.util.Locale;
  36 
  37 import org.xml.sax.Parser;      // deprecated
  38 import org.xml.sax.Locator;
  39 import org.xml.sax.InputSource;
  40 import org.xml.sax.AttributeList; // deprecated
  41 import org.xml.sax.EntityResolver;
  42 import org.xml.sax.DTDHandler;
  43 import org.xml.sax.DocumentHandler; // deprecated
  44 import org.xml.sax.ErrorHandler;
  45 import org.xml.sax.SAXException;
  46 
  47 import org.xml.sax.XMLReader;
  48 import org.xml.sax.Attributes;
  49 import org.xml.sax.ContentHandler;
  50 import org.xml.sax.SAXNotSupportedException;
  51 
  52 
  53 /**
  54  * Adapt a SAX2 XMLReader as a SAX1 Parser.
  55  *
  56  * <blockquote>
  57  * <em>This module, both source code and documentation, is in the
  58  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
  59  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
  60  * for further information.
  61  * </blockquote>
  62  *
  63  * <p>This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader}
  64  * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}.  The XMLReader
  65  * must support a true value for the
  66  * http://xml.org/sax/features/namespace-prefixes property or parsing will fail
  67  * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader
  68  * supports a false value for the http://xml.org/sax/features/namespaces
  69  * property, that will also be used to improve efficiency.</p>
  70  *
  71  * @since 1.4, SAX 2.0
  72  * @author David Megginson
  73  * @see org.xml.sax.Parser
  74  * @see org.xml.sax.XMLReader
  75  */
  76 @SuppressWarnings("deprecation")
  77 public class XMLReaderAdapter implements Parser, ContentHandler
  78 {
  79 
  80 
  81     ////////////////////////////////////////////////////////////////////


   1 /*
   2  * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 






  26 package org.xml.sax.helpers;
  27 
  28 import java.io.IOException;
  29 import java.util.Locale;
  30 
  31 import org.xml.sax.Parser;      // deprecated
  32 import org.xml.sax.Locator;
  33 import org.xml.sax.InputSource;
  34 import org.xml.sax.AttributeList; // deprecated
  35 import org.xml.sax.EntityResolver;
  36 import org.xml.sax.DTDHandler;
  37 import org.xml.sax.DocumentHandler; // deprecated
  38 import org.xml.sax.ErrorHandler;
  39 import org.xml.sax.SAXException;
  40 
  41 import org.xml.sax.XMLReader;
  42 import org.xml.sax.Attributes;
  43 import org.xml.sax.ContentHandler;
  44 import org.xml.sax.SAXNotSupportedException;
  45 
  46 
  47 /**
  48  * Adapt a SAX2 XMLReader as a SAX1 Parser.







  49  *
  50  * <p>This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader}
  51  * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}.  The XMLReader
  52  * must support a true value for the
  53  * http://xml.org/sax/features/namespace-prefixes property or parsing will fail
  54  * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader
  55  * supports a false value for the http://xml.org/sax/features/namespaces
  56  * property, that will also be used to improve efficiency.</p>
  57  *
  58  * @since 1.4, SAX 2.0
  59  * @author David Megginson
  60  * @see org.xml.sax.Parser
  61  * @see org.xml.sax.XMLReader
  62  */
  63 @SuppressWarnings("deprecation")
  64 public class XMLReaderAdapter implements Parser, ContentHandler
  65 {
  66 
  67 
  68     ////////////////////////////////////////////////////////////////////


< prev index next >