1/* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5/* 6 * Licensed to the Apache Software Foundation (ASF) under one or more 7 * contributor license agreements. See the NOTICE file distributed with 8 * this work for additional information regarding copyright ownership. 9 * The ASF licenses this file to You under the Apache License, Version 2.0 10 * (the "License"); you may not use this file except in compliance with 11 * the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22package com.sun.org.apache.xerces.internal.dom; 23 24import org.w3c.dom.DOMLocator; 25import org.w3c.dom.Node; 26 27 28/** 29 * <code>DOMLocatorImpl</code> is an implementaion that describes a location (e.g. 30 * where an error occured). 31 * <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010913'>Document Object Model (DOM) Level 3 Core Specification</a>. 32 * 33 * @xerces.internal 34 * 35 * @author Gopal Sharma, SUN Microsystems Inc. 36 */ 37 38public class DOMLocatorImpl implements DOMLocator { 39 40 // 41 // Data 42 // 43 44 /** 45 * The column number where the error occured, 46 * or -1 if there is no column number available. 47 */ 48 public int fColumnNumber = -1; 49 50 /** 51 * The line number where the error occured, 52 * or -1 if there is no line number available. 53 */ 54 public int fLineNumber = -1; 55 56 /** related data node*/ 57 public Node fRelatedNode = null; 58 59 /** 60 * The URI where the error occured, 61 * or null if there is no URI available. 62 */ 63 public String fUri = null; 64 65 /** 66 * The byte offset into the input source this locator is pointing to or -1 67 * if there is no byte offset available 68 */ 69 public int fByteOffset = -1; 70 71 /** 72 * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646], 73 * offset into the input source this locator is pointing to or -1 if there 74 * is no UTF-16 offset available. 75 */ 76 public int fUtf16Offset = -1; 77 78 // 79 // Constructors 80 // 81 82 public DOMLocatorImpl(){ 83 } 84 85 public DOMLocatorImpl (int lineNumber, int columnNumber, String uri ){ 86 fLineNumber = lineNumber ; 87 fColumnNumber = columnNumber ; 88 fUri = uri; 89 } // DOMLocatorImpl (int lineNumber, int columnNumber, String uri ) 90 91 public DOMLocatorImpl (int lineNumber, int columnNumber, int utf16Offset, String uri ){ 92 fLineNumber = lineNumber ; 93 fColumnNumber = columnNumber ; 94 fUri = uri; 95 fUtf16Offset = utf16Offset; 96 } // DOMLocatorImpl (int lineNumber, int columnNumber, int utf16Offset, String uri ) 97 98 public DOMLocatorImpl (int lineNumber, int columnNumber, int byteoffset, Node relatedData, String uri ){ 99 fLineNumber = lineNumber ; 100 fColumnNumber = columnNumber ; 101 fByteOffset = byteoffset ; 102 fRelatedNode = relatedData ; 103 fUri = uri; 104 } // DOMLocatorImpl (int lineNumber, int columnNumber, int offset, Node errorNode, String uri ) 105 106 public DOMLocatorImpl (int lineNumber, int columnNumber, int byteoffset, Node relatedData, String uri, int utf16Offset ){ 107 fLineNumber = lineNumber ; 108 fColumnNumber = columnNumber ; 109 fByteOffset = byteoffset ; 110 fRelatedNode = relatedData ; 111 fUri = uri; 112 fUtf16Offset = utf16Offset; 113 } // DOMLocatorImpl (int lineNumber, int columnNumber, int offset, Node errorNode, String uri ) 114 115 116 /** 117 * The line number where the error occured, or -1 if there is no line 118 * number available. 119 */ 120 public int getLineNumber(){ 121 return fLineNumber; 122 } 123 124 /** 125 * The column number where the error occured, or -1 if there is no column 126 * number available. 127 */ 128 public int getColumnNumber(){ 129 return fColumnNumber; 130 } 131 132 133 /** 134 * The URI where the error occured, or null if there is no URI available. 135 */ 136 public String getUri(){ 137 return fUri; 138 } 139 140 141 public Node getRelatedNode(){ 142 return fRelatedNode; 143 } 144 145 146 /** 147 * The byte offset into the input source this locator is pointing to or -1 148 * if there is no byte offset available 149 */ 150 public int getByteOffset(){ 151 return fByteOffset; 152 } 153 154 /** 155 * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646], 156 * offset into the input source this locator is pointing to or -1 if there 157 * is no UTF-16 offset available. 158 */ 159 public int getUtf16Offset(){ 160 return fUtf16Offset; 161 } 162 163}// class DOMLocatorImpl 164