当前位置: 首页>>代码示例>>Java>>正文


Java ValidationEventLocatorImpl类代码示例

本文整理汇总了Java中javax.xml.bind.helpers.ValidationEventLocatorImpl的典型用法代码示例。如果您正苦于以下问题:Java ValidationEventLocatorImpl类的具体用法?Java ValidationEventLocatorImpl怎么用?Java ValidationEventLocatorImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ValidationEventLocatorImpl类属于javax.xml.bind.helpers包,在下文中一共展示了ValidationEventLocatorImpl类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onIDREF

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:XMLSerializer.java

示例2: reconcileID

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:XMLSerializer.java

示例3: handleStartDocument

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:StAXConnector.java

示例4: reconcileIDs

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
/** Tests if all IDREFs have corresponding IDs. */
protected void reconcileIDs() throws SAXException {
    if(!validateID) return;
    
    for (Iterator itr = IDREFs.entrySet().iterator(); itr.hasNext();) {
        Map.Entry e = (Map.Entry) itr.next();
        
        if(IDs.contains(e.getKey()))
            continue;   // OK.
        
        // ID was not found.
        ValidatableObject source = (ValidatableObject)e.getValue();
        reportEvent(
            source,                
            new NotIdentifiableEventImpl( 
                ValidationEvent.ERROR,
                Messages.format( Messages.ID_NOT_FOUND, e.getKey() ),
                new ValidationEventLocatorImpl( source ) ) );
    }
    
    IDREFs.clear();
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:23,代码来源:ValidationContext.java

示例5: reconcileID

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
void reconcileID() throws AbortSerializationException {
    // find objects that were not a part of the object graph 
    idReferencedObjects.removeAll(objectsWithId);
    
    for( Iterator itr=idReferencedObjects.iterator(); itr.hasNext(); ) {
        IdentifiableObject o = (IdentifiableObject)itr.next();
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.format(Messages.ERR_DANGLING_IDREF,o.____jaxb____getId()),
            new ValidationEventLocatorImpl(o) ) );
    }
    
    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:17,代码来源:SAXMarshaller.java

示例6: handlePrintConversionException

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
/**
 * Reports a print conversion error while marshalling.
 */
public static void handlePrintConversionException(
    Object caller, Exception e, XMLSerializer serializer ) throws SAXException {
    
    if( e instanceof SAXException )
        // assume this exception is not from application.
        // (e.g., when a marshaller aborts the processing, this exception
        //        will be thrown) 
        throw (SAXException)e;
    
    String message = e.getMessage();
    if(message==null) {
        message = e.toString();
    }
    
    ValidationEvent ve = new PrintConversionEventImpl(
        ValidationEvent.ERROR, message,
        new ValidationEventLocatorImpl(caller), e );
    serializer.reportError(ve);
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:23,代码来源:Util.java

示例7: errorMissingId

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
/**
 * Called when a referenced object doesn't have an ID.
 */
public void errorMissingId(Object obj) throws SAXException {
    reportError( new ValidationEventImpl(
        ValidationEvent.ERROR,
        Messages.MISSING_ID.format(obj),
        new ValidationEventLocatorImpl(obj)) );
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:XMLSerializer.java

示例8: validateContent

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
@Override
protected boolean validateContent() {
    if (this.content == null)
        return false;
    RenderingMethodDescriptor erm = (RenderingMethodDescriptor) this.content;
    File shader_dir = null;
    String all_shaders = ":";
    shader_dir = new File(SHADER_PATH);
    if (shader_dir.exists() && shader_dir.isDirectory()) {
        for (File f : shader_dir.listFiles()) {
            all_shaders += f.getName() + ":";
        }
    }
    // Check that the shaders exist.
    boolean success = true;
    for (ShaderRef shader : erm.lshaderref) {
                if (!all_shaders.contains(shader.location.toString())) {
                    String error_msg = "The shader named " + shader.location.toString() + " doesn't exist or cannot be read in the shader directory " + (shader_dir == null ? "<null>" : shader_dir.getPath())
                            + ".";
                    ValidationEventLocatorImpl locator = new ValidationEventLocatorImpl(erm);
                    this.eventHandler.handleEvent(new SLDValidationEvent(ValidationEvent.FATAL_ERROR, error_msg, ll.getLocation(erm)));
                    success = false;
                }
        }
    // TODO : check if the parameters types and their restrictions are
    // valid.
    return success;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:29,代码来源:RenderingMethodValidatorXML.java

示例9: handlePrintConversionException

import javax.xml.bind.helpers.ValidationEventLocatorImpl; //导入依赖的package包/类
/**
 * Reports a print conversion error while marshalling.
 */
public static void handlePrintConversionException(
    Object caller, Exception e, XMLSerializer serializer ) throws SAXException {

    if( e instanceof SAXException )
        // assume this exception is not from application.
        // (e.g., when a marshaller aborts the processing, this exception
        //        will be thrown)
        throw (SAXException)e;

    ValidationEvent ve = new PrintConversionEventImpl(
        ValidationEvent.ERROR, e.getMessage(),
        new ValidationEventLocatorImpl(caller), e );
    serializer.reportError(ve);
}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:18,代码来源:RuntimeUtil.java


注:本文中的javax.xml.bind.helpers.ValidationEventLocatorImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。