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
25
26 package com.sun.xml.internal.xsom.impl.parser;
27
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;
34
35 import javax.xml.parsers.ParserConfigurationException;
36 import javax.xml.parsers.SAXParser;
37 import javax.xml.parsers.SAXParserFactory;
38 import java.io.IOException;
39
40
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 {
49
50 private final XMLParser parser;
51
52 public SAXParserFactoryAdaptor( XMLParser _parser ) {
53 this.parser = _parser;
54 }
55
56 public SAXParser newSAXParser() throws ParserConfigurationException, SAXException {
57 return new SAXParserImpl();
58 }
59
60 public void setFeature(String name, boolean value) {
61 ;
62 }
63
64 public boolean getFeature(String name) {
65 return false;
66 }
67
68 private class SAXParserImpl extends SAXParser
69 {
70 private final XMLReaderImpl reader = new XMLReaderImpl();
71
72 /**
73 * @deprecated
74 */
75 public org.xml.sax.Parser getParser() throws SAXException {
76 return new XMLReaderAdapter(reader);
77 }
78
79 public XMLReader getXMLReader() throws SAXException {
80 return reader;
81 }
|
1 /*
2 * Copyright (c) 1997, 2012, 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
25
26 package com.sun.xml.internal.xsom.impl.parser;
27
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;
34
35 import javax.xml.parsers.ParserConfigurationException;
36 import javax.xml.parsers.SAXParser;
37 import javax.xml.parsers.SAXParserFactory;
38 import java.io.IOException;
39
40
41 /**
42 * {@link SAXParserFactory} implementation that ultimately
43 * uses {@link XMLParser} to parse documents.
44 *
45 * @deprecated
46 *
47 * @author
48 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
49 */
50 public class SAXParserFactoryAdaptor extends SAXParserFactory {
51
52 private final XMLParser parser;
53
54 public SAXParserFactoryAdaptor( XMLParser _parser ) {
55 this.parser = _parser;
56 }
57
58 public SAXParser newSAXParser() throws ParserConfigurationException, SAXException {
59 return new SAXParserImpl();
60 }
61
62 public void setFeature(String name, boolean value) {
63 throw new UnsupportedOperationException("XSOM parser does not support JAXP features.");
64 }
65
66 public boolean getFeature(String name) {
67 return false;
68 }
69
70 private class SAXParserImpl extends SAXParser
71 {
72 private final XMLReaderImpl reader = new XMLReaderImpl();
73
74 /**
75 * @deprecated
76 */
77 public org.xml.sax.Parser getParser() throws SAXException {
78 return new XMLReaderAdapter(reader);
79 }
80
81 public XMLReader getXMLReader() throws SAXException {
82 return reader;
83 }
|