本文整理汇总了Java中javax.xml.bind.ValidationEventLocator.getOffset方法的典型用法代码示例。如果您正苦于以下问题:Java ValidationEventLocator.getOffset方法的具体用法?Java ValidationEventLocator.getOffset怎么用?Java ValidationEventLocator.getOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.bind.ValidationEventLocator
的用法示例。
在下文中一共展示了ValidationEventLocator.getOffset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Snapshot
import javax.xml.bind.ValidationEventLocator; //导入方法依赖的package包/类
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}
示例2: appendLocator
import javax.xml.bind.ValidationEventLocator; //导入方法依赖的package包/类
private static void appendLocator(StringBuilder sb, ValidationEventLocator loc) {
if (loc.getURL() == null
&& loc.getLineNumber() < 0
&& loc.getColumnNumber() < 0
&& loc.getOffset() < 0
&& loc.getNode() == null
&& loc.getObject() == null) {
return;
}
sb.append("(");
boolean first = true;
if (loc.getURL() != null) {
sb.append(loc.getURL().toExternalForm());
first = false;
}
if (loc.getLineNumber() >= 0) {
if (!first) {
sb.append(", ");
}
sb.append("line ").append(loc.getLineNumber());
first = false;
}
if (loc.getColumnNumber() >= 0) {
if (!first) {
sb.append(", ");
}
sb.append("column ").append(loc.getColumnNumber());
first = false;
}
if (loc.getOffset() >= 0) {
if (!first) {
sb.append(", ");
}
sb.append("byte ").append(loc.getOffset());
first = false;
}
if (loc.getObject() != null) {
if (!first) {
sb.append(", ");
}
sb.append("object ").append(loc.getObject().getClass().getName());
first = false;
}
if (loc.getNode() != null) {
if (!first) {
sb.append(", ");
}
sb.append("node ").append(loc.getNode().getLocalName());
first = false;
}
sb.append(") ");
}