src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/TeeXMLDocumentFilterImpl.java
author joehw
Thu, 21 Dec 2017 17:08:05 -0800
changeset 48412 d4412e380f6b
parent 47216 71c04702a3d5
permissions -rw-r--r--
8184431: References to @sun.com Reviewed-by: lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
44797
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     6
 * Licensed to the Apache Software Foundation (ASF) under one or more
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     7
 * contributor license agreements.  See the NOTICE file distributed with
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     8
 * this work for additional information regarding copyright ownership.
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     9
 * The ASF licenses this file to You under the Apache License, Version 2.0
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
    10
 * (the "License"); you may not use this file except in compliance with
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
    11
 * the License.  You may obtain a copy of the License at
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *      http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
package com.sun.org.apache.xerces.internal.jaxp;
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
import com.sun.org.apache.xerces.internal.xni.Augmentations;
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
import com.sun.org.apache.xerces.internal.xni.QName;
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
import com.sun.org.apache.xerces.internal.xni.XMLLocator;
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
import com.sun.org.apache.xerces.internal.xni.XMLString;
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
import com.sun.org.apache.xerces.internal.xni.XNIException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentFilter;
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * <p>XMLDocumentHandler which forks the pipeline to two other components.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 *
48412
d4412e380f6b 8184431: References to @sun.com
joehw
parents: 47216
diff changeset
    39
 * @author Kohsuke Kawaguchi
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
class TeeXMLDocumentFilterImpl implements XMLDocumentFilter {
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
     * The next component in the pipeline who receives the event.
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
     * This component receives events after the "side" handler
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
     * receives them.
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
    private XMLDocumentHandler next;
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
     * The component who intercepts events.
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
    private XMLDocumentHandler side;
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
     * The source of the event.
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
    private XMLDocumentSource source;
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
    public XMLDocumentHandler getSide() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
        return side;
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
    public void setSide(XMLDocumentHandler side) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
        this.side = side;
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
    public XMLDocumentSource getDocumentSource() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
        return source;
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
    public void setDocumentSource(XMLDocumentSource source) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
        this.source = source;
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
    public XMLDocumentHandler getDocumentHandler() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
        return next;
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
    public void setDocumentHandler(XMLDocumentHandler handler) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
        next = handler;
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
    //  XMLDocumentHandler implementation
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
    public void characters(XMLString text, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
        side.characters(text, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
        next.characters(text, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
    public void comment(XMLString text, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
        side.comment(text, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
        next.comment(text, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
    public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs)
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
        throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
        side.doctypeDecl(rootElement, publicId, systemId, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
        next.doctypeDecl(rootElement, publicId, systemId, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
        side.emptyElement(element, attributes, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
        next.emptyElement(element, attributes, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
    public void endCDATA(Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
        side.endCDATA(augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
        next.endCDATA(augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
    public void endDocument(Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
        side.endDocument(augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
        next.endDocument(augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
    public void endElement(QName element, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
        side.endElement(element, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
        next.endElement(element, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
    public void endGeneralEntity(String name, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
        side.endGeneralEntity(name, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
        next.endGeneralEntity(name, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
    public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
        side.ignorableWhitespace(text, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
        next.ignorableWhitespace(text, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
    public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
        side.processingInstruction(target, data, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
        next.processingInstruction(target, data, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
    public void startCDATA(Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
        side.startCDATA(augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
        next.startCDATA(augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
    public void startDocument(
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
            XMLLocator locator,
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
            String encoding,
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
            NamespaceContext namespaceContext,
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
            Augmentations augs)
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
        throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
        side.startDocument(locator, encoding, namespaceContext, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
        next.startDocument(locator, encoding, namespaceContext, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
    public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
        side.startElement(element, attributes, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
        next.startElement(element, attributes, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
    public void startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs)
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
        throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
        side.startGeneralEntity(name, identifier, encoding, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
        next.startGeneralEntity(name, identifier, encoding, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
    public void textDecl(String version, String encoding, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
        side.textDecl(version, encoding, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
        next.textDecl(version, encoding, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
    public void xmlDecl(String version, String encoding, String standalone, Augmentations augs) throws XNIException {
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
        side.xmlDecl(version, encoding, standalone, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
        next.xmlDecl(version, encoding, standalone, augs);
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
}