本文整理汇总了Java中org.w3c.dom.DOMError.getLocation方法的典型用法代码示例。如果您正苦于以下问题:Java DOMError.getLocation方法的具体用法?Java DOMError.getLocation怎么用?Java DOMError.getLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.DOMError
的用法示例。
在下文中一共展示了DOMError.getLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DOMErrorImpl
import org.w3c.dom.DOMError; //导入方法依赖的package包/类
/**
* Public constructor
*
*/
public DOMErrorImpl(DOMError src) {
this.severity = src.getSeverity();
this.message = src.getMessage();
this.type = src.getType();
this.relatedException = src.getRelatedException();
this.relatedData = src.getRelatedData();
this.location = new DOMLocatorImpl(src.getLocation());
}
示例2: printError
import org.w3c.dom.DOMError; //导入方法依赖的package包/类
/** Prints the error message. */
private void printError(DOMError error) {
int severity = error.getSeverity();
fOut.print("[");
if ( severity == DOMError.SEVERITY_WARNING) {
fOut.print("Warning");
} else if ( severity == DOMError.SEVERITY_ERROR) {
fOut.print("Error");
} else {
fOut.print("FatalError");
eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to??
}
fOut.print("] ");
DOMLocator locator = error.getLocation();
if (locator != null) {
fOut.print(locator.getLineNumber());
fOut.print(":");
fOut.print(locator.getColumnNumber());
fOut.print(":");
fOut.print(locator.getByteOffset());
fOut.print(",");
fOut.print(locator.getUtf16Offset());
Node node = locator.getRelatedNode();
if (node != null) {
fOut.print("[");
fOut.print(node.getNodeName());
fOut.print("]");
}
String systemId = locator.getUri();
if (systemId != null) {
int index = systemId.lastIndexOf('/');
if (index != -1)
systemId = systemId.substring(index + 1);
fOut.print(": ");
fOut.print(systemId);
}
}
fOut.print(":");
fOut.print(error.getMessage());
fOut.println();
fOut.flush();
}
示例3: printError
import org.w3c.dom.DOMError; //导入方法依赖的package包/类
/** Prints the error message. */
private void printError(DOMError error) {
int severity = error.getSeverity();
fOut.print("[");
if ( severity == DOMError.SEVERITY_WARNING) {
fOut.print("Warning");
} else if ( severity == DOMError.SEVERITY_ERROR) {
fOut.print("Error");
} else {
fOut.print("FatalError");
eStatus = false ; //REVISIT: Abort processing if fatal error, do we need to??
}
fOut.print("] ");
DOMLocator locator = error.getLocation();
if (locator != null) {
fOut.print(locator.getLineNumber());
fOut.print(":");
fOut.print(locator.getColumnNumber());
fOut.print(":");
fOut.print(locator.getByteOffset());
fOut.print(",");
fOut.print(locator.getUtf16Offset());
Node node = locator.getRelatedNode();
if (node != null) {
fOut.print("[");
fOut.print(node.getNodeName());
fOut.print("]");
}
String systemId = locator.getUri();
if (systemId != null) {
int index = systemId.lastIndexOf('/');
if (index != -1)
systemId = systemId.substring(index + 1);
fOut.print(": ");
fOut.print(systemId);
}
}
fOut.print(":");
fOut.print(error.getMessage());
fOut.println();
fOut.flush();
}