jaxp/src/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAnnotationInfo.java
author ohair
Sun, 04 Mar 2012 11:55:34 -0800
changeset 12005 a754d69d5e60
parent 6 7f561c08de6b
permissions -rw-r--r--
7150324: Stop using drop bundles in jaxp Reviewed-by: prr, joehw
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
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * Copyright 2004 The Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * You may obtain a copy of the License at
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
package com.sun.org.apache.xerces.internal.impl.xs.traversers;
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
import org.w3c.dom.Element;
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
import com.sun.org.apache.xerces.internal.impl.xs.opti.ElementImpl;
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
 * Objects of this class contain the textual representation of
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
 * an XML schema annotation as well as information on the location
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
 * of the annotation in the document it originated from.
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 * @xerces.internal
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 * @author Michael Glavassevich, IBM
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
final class XSAnnotationInfo {
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
    /** Textual representation of annotation. **/
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
    String fAnnotation;
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
    /** Line number of <annotation> element. **/
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
    int fLine;
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
    /** Column number of <annotation> element. **/
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
    int fColumn;
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
    /** Character offset of <annotation> element. **/
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
    int fCharOffset;
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
    /** Next annotation. **/
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
    XSAnnotationInfo next;
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
    XSAnnotationInfo(String annotation, int line, int column, int charOffset) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
        fAnnotation = annotation;
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
        fLine = line;
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
        fColumn = column;
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
        fCharOffset = charOffset;
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
    XSAnnotationInfo(String annotation, Element annotationDecl) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
        fAnnotation = annotation;
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
        if (annotationDecl instanceof ElementImpl) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
            final ElementImpl annotationDeclImpl = (ElementImpl) annotationDecl;
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
            fLine = annotationDeclImpl.getLineNumber();
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
            fColumn = annotationDeclImpl.getColumnNumber();
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
            fCharOffset = annotationDeclImpl.getCharacterOffset();
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
        else {
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
            fLine = -1;
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
            fColumn = -1;
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
            fCharOffset = -1;
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
} // XSAnnotationInfo