1 57 58 package com.sun.org.apache.xerces.internal.xni.parser; 59 60 import com.sun.org.apache.xerces.internal.xni.XMLLocator; 61 import com.sun.org.apache.xerces.internal.xni.XNIException; 62 63 72 public class XMLParseException 73 extends XNIException { 74 75 79 80 protected String fPublicId; 81 82 83 protected String fLiteralSystemId; 84 85 86 protected String fExpandedSystemId; 87 88 89 protected String fBaseSystemId; 90 91 92 protected int fLineNumber = -1; 93 94 95 protected int fColumnNumber = -1; 96 97 101 102 public XMLParseException(XMLLocator locator, String message) { 103 super(message); 104 if (locator != null) { 105 fPublicId = locator.getPublicId(); 106 fLiteralSystemId = locator.getLiteralSystemId(); 107 fExpandedSystemId = locator.getExpandedSystemId(); 108 fBaseSystemId = locator.getBaseSystemId(); 109 fLineNumber = locator.getLineNumber(); 110 fColumnNumber = locator.getColumnNumber(); 111 } 112 } 114 115 public XMLParseException(XMLLocator locator, 116 String message, Exception exception) { 117 super(message, exception); 118 fPublicId = locator.getPublicId(); 119 fLiteralSystemId = locator.getLiteralSystemId(); 120 fExpandedSystemId = locator.getExpandedSystemId(); 121 fBaseSystemId = locator.getBaseSystemId(); 122 fLineNumber = locator.getLineNumber(); 123 fColumnNumber = locator.getColumnNumber(); 124 } 126 130 131 public String getPublicId() { 132 return fPublicId; 133 } 135 136 public String getExpandedSystemId() { 137 return fExpandedSystemId; 138 } 140 141 public String getLiteralSystemId() { 142 return fLiteralSystemId; 143 } 145 146 public String getBaseSystemId() { 147 return fBaseSystemId; 148 } 150 151 public int getLineNumber() { 152 return fLineNumber; 153 } 155 156 public int getColumnNumber() { 157 return fColumnNumber; 158 } 160 164 165 public String toString() { 166 167 StringBuffer str = new StringBuffer (); 168 if (fPublicId != null) { 169 str.append(fPublicId); 170 } 171 str.append(':'); 172 if (fPublicId != null) { 173 str.append(fPublicId); 174 } 175 str.append(':'); 176 if (fLiteralSystemId != null) { 177 str.append(fLiteralSystemId); 178 } 179 str.append(':'); 180 if (fExpandedSystemId != null) { 181 str.append(fExpandedSystemId); 182 } 183 str.append(':'); 184 if (fBaseSystemId != null) { 185 str.append(fBaseSystemId); 186 } 187 str.append(':'); 188 str.append(fLineNumber); 189 str.append(':'); 190 str.append(fColumnNumber); 191 str.append(':'); 192 String message = getMessage(); 193 if (message == null) { 194 Exception exception = getException(); 195 if (exception != null) { 196 message = exception.getMessage(); 197 } 198 } 199 if (message != null) { 200 str.append(message); 201 } 202 return str.toString(); 203 204 } 206 } | Popular Tags |