01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.xerces.impl.xs.traversers;
18:
19: import org.w3c.dom.Element;
20: import org.apache.xerces.impl.xs.opti.ElementImpl;
21:
22: /**
23: * Objects of this class contain the textual representation of
24: * an XML schema annotation as well as information on the location
25: * of the annotation in the document it originated from.
26: *
27: * @xerces.internal
28: *
29: * @author Michael Glavassevich, IBM
30: * @version $Id: XSAnnotationInfo.java 446725 2006-09-15 20:40:10Z mrglavas $
31: */
32: final class XSAnnotationInfo {
33:
34: /** Textual representation of annotation. **/
35: String fAnnotation;
36:
37: /** Line number of <annotation> element. **/
38: int fLine;
39:
40: /** Column number of <annotation> element. **/
41: int fColumn;
42:
43: /** Character offset of <annotation> element. **/
44: int fCharOffset;
45:
46: /** Next annotation. **/
47: XSAnnotationInfo next;
48:
49: XSAnnotationInfo(String annotation, int line, int column,
50: int charOffset) {
51: fAnnotation = annotation;
52: fLine = line;
53: fColumn = column;
54: fCharOffset = charOffset;
55: }
56:
57: XSAnnotationInfo(String annotation, Element annotationDecl) {
58: fAnnotation = annotation;
59: if (annotationDecl instanceof ElementImpl) {
60: final ElementImpl annotationDeclImpl = (ElementImpl) annotationDecl;
61: fLine = annotationDeclImpl.getLineNumber();
62: fColumn = annotationDeclImpl.getColumnNumber();
63: fCharOffset = annotationDeclImpl.getCharacterOffset();
64: } else {
65: fLine = -1;
66: fColumn = -1;
67: fCharOffset = -1;
68: }
69: }
70: } // XSAnnotationInfo
|