类javax.xml.bind.ValidationEventLocator源码实例Demo

下面列出了怎么用javax.xml.bind.ValidationEventLocator的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: sldeditor   文件: ParseXML.java
/**
 * Output parse errors.
 *
 * @param fullResourceName the full resource name
 * @param vec the vec
 * @param xsdURL the xsd URL
 */
private static void outputParseErrors(
        String fullResourceName, ValidationEventCollector vec, URL xsdURL) {
    if (vec.hasEvents()) {

        for (ValidationEvent ve : vec.getEvents()) {
            String msg = ve.getMessage();
            ValidationEventLocator vel = ve.getLocator();

            String message =
                    String.format(
                            "%s %s %s %s %s %d %s %d %s",
                            Localisation.getField(ParseXML.class, "ParseXML.failedToValidate"),
                            fullResourceName,
                            Localisation.getField(ParseXML.class, "ParseXML.usingXSD"),
                            xsdURL.toString(),
                            Localisation.getField(ParseXML.class, "ParseXML.line"),
                            vel.getLineNumber(),
                            Localisation.getField(ParseXML.class, "ParseXML.column"),
                            vel.getColumnNumber(),
                            msg);
            ConsoleManager.getInstance().error(ParseXML.class, message);
        }
    }
}
 
源代码2 项目: openjdk-8-source   文件: StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
@Nullable
@OverrideOnDemand
protected String getErrorFieldName (@Nullable final ValidationEventLocator aLocator)
{
  if (aLocator != null)
  {
    // Source object found?
    final Object aObj = aLocator.getObject ();
    if (aObj != null)
      return "obj: " + aObj.toString ();

    // Source node found?
    final Node aNode = aLocator.getNode ();
    if (aNode != null)
      return XMLWriter.getNodeAsString (aNode);
  }
  return null;
}
 
源代码4 项目: jdk8u60   文件: StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
源代码5 项目: openjdk-8   文件: StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
源代码6 项目: 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();
}
 
源代码7 项目: openjdk-8   文件: LocatorEx.java
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();
}
 
源代码8 项目: hottub   文件: LocatorEx.java
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();
}
 
源代码9 项目: openjdk-8-source   文件: LocatorEx.java
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();
}
 
源代码10 项目: 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();
}
 
源代码11 项目: 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();
   }
}
 
源代码12 项目: openjdk-jdk8u-backup   文件: LocatorEx.java
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();
}
 
/**
 * 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 项目: 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();
}
 
源代码15 项目: sailfish-core   文件: XMLTransmitter.java
@Override
public boolean handleEvent(ValidationEvent ve) {
	String msg = ve.getMessage();
	ValidationEventLocator vel = ve.getLocator();
	logger.error(  "location  : {}.{}: {}", vel.getLineNumber(), vel.getColumnNumber(), msg );
	return false;
}
 
源代码16 项目: openjdk-jdk8u   文件: LocatorEx.java
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();
}
 
源代码17 项目: hottub   文件: UnmarshallingContext.java
@Override
protected ValidationEventLocator getLocation() {
    return locator.getLocation();
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: LocatorExWrapper.java
public ValidationEventLocator getLocation() {
    return new ValidationEventLocatorImpl(locator);
}
 
源代码19 项目: TencentKona-8   文件: XMLSerializer.java
public ValidationEventLocator getCurrentLocation(String fieldName) {
    return new ValidationEventLocatorExImpl(cycleDetectionStack.peek(),fieldName);
}
 
源代码20 项目: TencentKona-8   文件: LocatorExWrapper.java
public ValidationEventLocator getLocation() {
    return new ValidationEventLocatorImpl(locator);
}
 
源代码21 项目: TencentKona-8   文件: LocatorEx.java
public ValidationEventLocator getLocation() {
    return this;
}
 
源代码22 项目: TencentKona-8   文件: UnmarshallingContext.java
@Override
protected ValidationEventLocator getLocation() {
    return locator.getLocation();
}
 
源代码23 项目: TencentKona-8   文件: DOMScanner.java
public ValidationEventLocator getLocation() {
    return new ValidationEventLocatorImpl(getCurrentLocation());
}
 
源代码24 项目: hottub   文件: ValidationEventImpl.java
public ValidationEventLocator getLocator() {
    return locator;
}
 
源代码25 项目: openjdk-8-source   文件: XMLSerializer.java
public ValidationEventLocator getCurrentLocation(String fieldName) {
    return new ValidationEventLocatorExImpl(cycleDetectionStack.peek(),fieldName);
}
 
源代码26 项目: TencentKona-8   文件: ValidationEventImpl.java
public ValidationEventLocator getLocator() {
    return locator;
}
 
源代码27 项目: openjdk-8-source   文件: DOMScanner.java
public ValidationEventLocator getLocation() {
    return new ValidationEventLocatorImpl(getCurrentLocation());
}
 
源代码28 项目: jdk8u60   文件: XMLSerializer.java
public ValidationEventLocator getCurrentLocation(String fieldName) {
    return new ValidationEventLocatorExImpl(cycleDetectionStack.peek(),fieldName);
}
 
源代码29 项目: openjdk-jdk8u-backup   文件: XMLSerializer.java
public ValidationEventLocator getCurrentLocation(String fieldName) {
    return new ValidationEventLocatorExImpl(cycleDetectionStack.peek(),fieldName);
}
 
源代码30 项目: jdk8u60   文件: LocatorExWrapper.java
public ValidationEventLocator getLocation() {
    return new ValidationEventLocatorImpl(locator);
}