< prev index next >

src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.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 // ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader.
  27 // http://www.saxproject.org
  28 // Written by David Megginson
  29 // NO WARRANTY!  This class is in the public domain.
  30 // $Id: ParserAdapter.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.ArrayList;
  36 import java.util.Enumeration;
  37 import java.util.List;
  38 import jdk.xml.internal.SecuritySupport;
  39 import org.xml.sax.AttributeList; // deprecated
  40 import org.xml.sax.Attributes;
  41 import org.xml.sax.ContentHandler;
  42 import org.xml.sax.DTDHandler;
  43 import org.xml.sax.DocumentHandler; // deprecated
  44 import org.xml.sax.EntityResolver;
  45 import org.xml.sax.ErrorHandler;
  46 import org.xml.sax.InputSource;
  47 import org.xml.sax.Locator;
  48 import org.xml.sax.Parser;      // deprecated
  49 import org.xml.sax.SAXException;
  50 import org.xml.sax.SAXNotRecognizedException;
  51 import org.xml.sax.SAXNotSupportedException;
  52 import org.xml.sax.SAXParseException;
  53 import org.xml.sax.XMLReader;
  54 
  55 
  56 /**
  57  * Adapt a SAX1 Parser as a SAX2 XMLReader.
  58  *
  59  * <blockquote>
  60  * <em>This module, both source code and documentation, is in the
  61  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
  62  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
  63  * for further information.
  64  * </blockquote>
  65  *
  66  * <p>This class wraps a SAX1 {@link org.xml.sax.Parser Parser}
  67  * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader},
  68  * with feature, property, and Namespace support.  Note
  69  * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity
  70  * skippedEntity} events, since SAX1 does not make that information available.</p>
  71  *
  72  * <p>This adapter does not test for duplicate Namespace-qualified
  73  * attribute names.</p>
  74  *
  75  * @since 1.4, SAX 2.0
  76  * @author David Megginson
  77  * @version 2.0.1 (sax2r2)
  78  * @see org.xml.sax.helpers.XMLReaderAdapter
  79  * @see org.xml.sax.XMLReader
  80  * @see org.xml.sax.Parser
  81  */
  82 @SuppressWarnings("deprecation")
  83 public class ParserAdapter implements XMLReader, DocumentHandler
  84 {


   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.ArrayList;
  30 import java.util.Enumeration;
  31 import java.util.List;
  32 import jdk.xml.internal.SecuritySupport;
  33 import org.xml.sax.AttributeList; // deprecated
  34 import org.xml.sax.Attributes;
  35 import org.xml.sax.ContentHandler;
  36 import org.xml.sax.DTDHandler;
  37 import org.xml.sax.DocumentHandler; // deprecated
  38 import org.xml.sax.EntityResolver;
  39 import org.xml.sax.ErrorHandler;
  40 import org.xml.sax.InputSource;
  41 import org.xml.sax.Locator;
  42 import org.xml.sax.Parser;      // deprecated
  43 import org.xml.sax.SAXException;
  44 import org.xml.sax.SAXNotRecognizedException;
  45 import org.xml.sax.SAXNotSupportedException;
  46 import org.xml.sax.SAXParseException;
  47 import org.xml.sax.XMLReader;
  48 
  49 
  50 /**
  51  * Adapt a SAX1 Parser as a SAX2 XMLReader.







  52  *
  53  * <p>This class wraps a SAX1 {@link org.xml.sax.Parser Parser}
  54  * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader},
  55  * with feature, property, and Namespace support.  Note
  56  * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity
  57  * skippedEntity} events, since SAX1 does not make that information available.</p>
  58  *
  59  * <p>This adapter does not test for duplicate Namespace-qualified
  60  * attribute names.</p>
  61  *
  62  * @since 1.4, SAX 2.0
  63  * @author David Megginson
  64  * @version 2.0.1 (sax2r2)
  65  * @see org.xml.sax.helpers.XMLReaderAdapter
  66  * @see org.xml.sax.XMLReader
  67  * @see org.xml.sax.Parser
  68  */
  69 @SuppressWarnings("deprecation")
  70 public class ParserAdapter implements XMLReader, DocumentHandler
  71 {


< prev index next >