src/share/jaxws_classes/com/sun/xml/internal/xsom/impl/parser/SAXParserFactoryAdaptor.java

Tue, 06 Mar 2012 16:09:35 -0800

author
ohair
date
Tue, 06 Mar 2012 16:09:35 -0800
changeset 286
f50545b5e2f1
child 397
b99d7e355d4b
permissions
-rw-r--r--

7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom

     1 /*
     2  * Copyright (c) 1997, 2011, 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  */
    26 package com.sun.xml.internal.xsom.impl.parser;
    28 import com.sun.xml.internal.xsom.parser.XMLParser;
    29 import org.xml.sax.InputSource;
    30 import org.xml.sax.SAXException;
    31 import org.xml.sax.XMLReader;
    32 import org.xml.sax.helpers.XMLFilterImpl;
    33 import org.xml.sax.helpers.XMLReaderAdapter;
    35 import javax.xml.parsers.ParserConfigurationException;
    36 import javax.xml.parsers.SAXParser;
    37 import javax.xml.parsers.SAXParserFactory;
    38 import java.io.IOException;
    41 /**
    42  * {@link SAXParserFactory} implementation that ultimately
    43  * uses {@link XMLParser} to parse documents.
    44  *
    45  * @author
    46  *     Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
    47  */
    48 public class SAXParserFactoryAdaptor extends SAXParserFactory {
    50     private final XMLParser parser;
    52     public SAXParserFactoryAdaptor( XMLParser _parser ) {
    53         this.parser = _parser;
    54     }
    56     public SAXParser newSAXParser() throws ParserConfigurationException, SAXException {
    57         return new SAXParserImpl();
    58     }
    60     public void setFeature(String name, boolean value) {
    61         ;
    62     }
    64     public boolean getFeature(String name) {
    65         return false;
    66     }
    68     private class SAXParserImpl extends SAXParser
    69     {
    70         private final XMLReaderImpl reader = new XMLReaderImpl();
    72         /**
    73          * @deprecated
    74          */
    75         public org.xml.sax.Parser getParser() throws SAXException {
    76             return new XMLReaderAdapter(reader);
    77         }
    79         public XMLReader getXMLReader() throws SAXException {
    80             return reader;
    81         }
    83         public boolean isNamespaceAware() {
    84             return true;
    85         }
    87         public boolean isValidating() {
    88             return false;
    89         }
    91         public void setProperty(String name, Object value) {
    92         }
    94         public Object getProperty(String name) {
    95             return null;
    96         }
    97     }
    99     private class XMLReaderImpl extends XMLFilterImpl
   100     {
   101         public void parse(InputSource input) throws IOException, SAXException {
   102             parser.parse(input,this,this,this);
   103         }
   105         public void parse(String systemId) throws IOException, SAXException {
   106             parser.parse(new InputSource(systemId),this,this,this);
   107         }
   108     }
   109 }

mercurial