本文整理汇总了Java中javax.xml.bind.ValidationEventLocator.getURL方法的典型用法代码示例。如果您正苦于以下问题:Java ValidationEventLocator.getURL方法的具体用法?Java ValidationEventLocator.getURL怎么用?Java ValidationEventLocator.getURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.bind.ValidationEventLocator
的用法示例。
在下文中一共展示了ValidationEventLocator.getURL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getLocation
import javax.xml.bind.ValidationEventLocator; //导入方法依赖的package包/类
/**
* Calculate a location message for the event
*
*/
private String getLocation(ValidationEvent event) {
StringBuffer msg = new StringBuffer();
ValidationEventLocator locator = event.getLocator();
if( locator != null ) {
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if( url!=null || line!=-1 ) {
msg.append( "line " + line );
if( url!=null )
msg.append( " of " + url );
} else if( obj != null ) {
msg.append( " obj: " + obj.toString() );
} else if( node != null ) {
msg.append( " node: " + node.toString() );
}
} else {
msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) );
}
return msg.toString();
}
示例3: getErrorLocation
import javax.xml.bind.ValidationEventLocator; //导入方法依赖的package包/类
/**
* Calculates a location message for the event.
*
* {@link DefaultValidationEventHandler#getLocation(ValidationEvent)}
*/
public static String getErrorLocation(ValidationEvent event)
{
StringBuilder msg = new StringBuilder();
ValidationEventLocator locator = event.getLocator();
if (locator != null)
{
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if (url != null || line != -1)
{
msg.append("line " + line);
if (url != null)
msg.append(" of " + url);
}
else if (obj != null)
{
msg.append(" obj: " + obj.toString());
}
else if (node != null)
{
msg.append(" node: " + node.toString());
}
}
else
{
msg.append("Cannot determinate the location of the error/warning");
}
return msg.toString();
}
示例4: getLocationResourceID
import javax.xml.bind.ValidationEventLocator; //导入方法依赖的package包/类
@Nullable
@OverrideOnDemand
protected String getLocationResourceID (@Nullable final ValidationEventLocator aLocator)
{
if (aLocator != null)
{
// Source file found?
final URL aURL = aLocator.getURL ();
if (aURL != null)
return aURL.toString ();
}
return null;
}
示例5: 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(") ");
}