javax.xml.bind.ValidationEventLocator#getLineNumber ( )源码实例Demo

下面列出了javax.xml.bind.ValidationEventLocator#getLineNumber ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * 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();
}
 
/**
 * 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 项目: freehealth-connector   文件: XmlBindingTool.java
private String getLocationDescription(ValidationEvent event) {
   ValidationEventLocator locator = event.getLocator();
   if (locator == null) {
      return "XML with location unavailable";
   } else {
      StringBuffer msg = new StringBuffer();
      URL url = locator.getURL();
      Object obj = locator.getObject();
      Node node = locator.getNode();
      int line = locator.getLineNumber();
      if (url == null && line == -1) {
         if (obj != null) {
            msg.append("obj: ");
            msg.append(obj);
         } else if (node != null) {
            msg.append("node: ");
            msg.append(node);
         }
      } else {
         msg.append("line ");
         msg.append(line);
         if (url != null) {
            msg.append(" of ");
            msg.append(url);
         }
      }

      return msg.toString();
   }
}
 
源代码4 项目: freehealth-connector   文件: XmlBindingTool.java
private String getLocationDescription(ValidationEvent event) {
   ValidationEventLocator locator = event.getLocator();
   if (locator == null) {
      return "XML with location unavailable";
   } else {
      StringBuffer msg = new StringBuffer();
      URL url = locator.getURL();
      Object obj = locator.getObject();
      Node node = locator.getNode();
      int line = locator.getLineNumber();
      if (url == null && line == -1) {
         if (obj != null) {
            msg.append("obj: ");
            msg.append(obj);
         } else if (node != null) {
            msg.append("node: ");
            msg.append(node);
         }
      } else {
         msg.append("line ");
         msg.append(line);
         if (url != null) {
            msg.append(" of ");
            msg.append(url);
         }
      }

      return msg.toString();
   }
}
 
源代码5 项目: jdk8u60   文件: DefaultValidationEventHandler.java
/**
 * 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();
}
 
/**
 * 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();
}
 
源代码7 项目: aion-germany   文件: XmlValidationHandler.java
@Override
public boolean handleEvent(ValidationEvent event) {
	if (event.getSeverity() == ValidationEvent.FATAL_ERROR || event.getSeverity() == ValidationEvent.ERROR) {
		ValidationEventLocator locator = event.getLocator();
		String message = event.getMessage();
		int line = locator.getLineNumber();
		int column = locator.getColumnNumber();
		log.error("Error at [line=" + line + ", column=" + column + "]: " + message);
		throw new Error(event.getLinkedException());
	}
	return true;
}
 
/**
 * 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();
}
 
@Override
public boolean handleEvent(ValidationEvent validationEvent) {
	ValidationEventLocator locator = validationEvent.getLocator();
	lineNumber = locator.getLineNumber();
	columnNumber = locator.getColumnNumber();
	message = validationEvent.getMessage();
	return false;
}
 
源代码10 项目: lams   文件: JaxbCfgProcessor.java
@Override
public boolean handleEvent(ValidationEvent validationEvent) {
	ValidationEventLocator locator = validationEvent.getLocator();
	lineNumber = locator.getLineNumber();
	columnNumber = locator.getColumnNumber();
	message = validationEvent.getMessage();
	return false;
}
 
/**
 * 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();
}
 
/**
 * 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();
}
 
源代码13 项目: Java8CN   文件: DefaultValidationEventHandler.java
/**
 * 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();
}
 
源代码14 项目: hottub   文件: DefaultValidationEventHandler.java
/**
 * 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();
}
 
/**
 * 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();
}
 
源代码16 项目: openjdk-8   文件: DefaultValidationEventHandler.java
/**
 * 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();
}