Sat, 07 Nov 2020 10:30:02 +0800
Added tag mips-jdk8u275-b01 for changeset fdbe50121f48
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
23 * questions.
24 */
26 package com.sun.xml.internal.ws.wsdl.writer;
28 import java.util.Stack;
30 import org.xml.sax.Attributes;
31 import org.xml.sax.ContentHandler;
32 import org.xml.sax.Locator;
33 import org.xml.sax.SAXException;
35 import com.sun.xml.internal.txw2.TypedXmlWriter;
37 public class TXWContentHandler implements ContentHandler {
38 Stack<TypedXmlWriter> stack;
40 public TXWContentHandler(TypedXmlWriter txw) {
41 stack = new Stack<TypedXmlWriter>();
42 stack.push(txw);
43 }
45 public void setDocumentLocator(Locator locator) {
46 }
48 public void startDocument() throws SAXException {
49 }
51 public void endDocument() throws SAXException {
52 }
54 public void startPrefixMapping(String prefix, String uri) throws SAXException {
55 }
57 public void endPrefixMapping(String prefix) throws SAXException {
58 }
60 public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
61 TypedXmlWriter txw = stack.peek()._element(uri, localName, TypedXmlWriter.class);
62 stack.push(txw);
63 if (atts != null) {
64 for(int i = 0; i < atts.getLength(); i++) {
65 String auri = atts.getURI(i);
66 if ("http://www.w3.org/2000/xmlns/".equals(auri)) {
67 if ("xmlns".equals(atts.getLocalName(i)))
68 txw._namespace(atts.getValue(i), "");
69 else
70 txw._namespace(atts.getValue(i),atts.getLocalName(i));
71 } else {
72 if ("schemaLocation".equals(atts.getLocalName(i))
73 && "".equals(atts.getValue(i)))
74 continue;
75 txw._attribute(auri, atts.getLocalName(i), atts.getValue(i));
76 }
77 }
78 }
79 }
81 public void endElement(String uri, String localName, String qName) throws SAXException {
82 stack.pop();
83 }
85 public void characters(char[] ch, int start, int length) throws SAXException {
86 }
88 public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
89 }
91 public void processingInstruction(String target, String data) throws SAXException {
92 }
94 public void skippedEntity(String name) throws SAXException {
95 }
97 }