1 28 29 package net.n3.nanoxml; 30 31 38 public class XMLValidationException extends XMLException 39 { 40 41 44 private static final long serialVersionUID = 3616453380025890867L; 45 46 49 public static final int MISSING_ELEMENT = 1; 50 51 54 public static final int UNEXPECTED_ELEMENT = 2; 55 56 59 public static final int MISSING_ATTRIBUTE = 3; 60 61 64 public static final int UNEXPECTED_ATTRIBUTE = 4; 65 66 69 public static final int ATTRIBUTE_WITH_INVALID_VALUE = 5; 70 71 74 public static final int MISSING_PCDATA = 6; 75 76 79 public static final int UNEXPECTED_PCDATA = 7; 80 81 84 public static final int MISC_ERROR = 0; 85 86 89 private String elementName; 90 91 94 private String attributeName; 95 96 99 private String attributeValue; 100 101 112 public XMLValidationException(int errorType, String systemID, int lineNr, String elementName, 113 String attributeName, String attributeValue, String msg) 114 { 115 super(systemID, lineNr, null, msg 116 + ((elementName == null) ? "" : (", element=" + elementName)) 117 + ((attributeName == null) ? "" : (", attribute=" + attributeName)) 118 + ((attributeValue == null) ? "" : (", value='" + attributeValue + "'")), false); 119 this.elementName = elementName; 120 this.attributeName = attributeName; 121 this.attributeValue = attributeValue; 122 } 123 124 127 protected void finalize() throws Throwable 128 { 129 this.elementName = null; 130 this.attributeName = null; 131 this.attributeValue = null; 132 super.finalize(); 133 } 134 135 139 public String getElementName() 140 { 141 return this.elementName; 142 } 143 144 148 public String getAttributeName() 149 { 150 return this.attributeName; 151 } 152 153 157 public String getAttributeValue() 158 { 159 return this.attributeValue; 160 } 161 162 } 163 | Popular Tags |