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