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


Java StringRef类代码示例

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


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

示例1: endAttribute

import com.sun.msv.util.StringRef; //导入依赖的package包/类
public void endAttribute() throws SAXException {
    insideAttribute = false;
    if(!acceptor.onAttribute2( attNamespaceUri, attLocalName,
        attLocalName /* we don't have QName, so just use the local name */,
        buf.toString(),
        this, null, null )) {
        
        // either the name was incorrect (which is quite unlikely),
        // or the value was wrong.
        // report an error
        StringRef ref = new StringRef();
        acceptor.onAttribute2( attNamespaceUri, attLocalName, attLocalName,
        buf.toString(), this, ref, null );
        
        context.reportEvent(target,ref.str);
    }
    
    buf = new StringBuffer();
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:20,代码来源:MSVValidator.java

示例2: reportError

import com.sun.msv.util.StringRef; //导入依赖的package包/类
private void reportError(StringRef errorRef)
    throws XMLStreamException
{
    String msg = errorRef.str;
    errorRef.str = null;
    if (msg == null) {
        msg = "Unknown reason";
    }
    reportError(msg);
}
 
开发者ID:FasterXML,项目名称:woodstox,代码行数:11,代码来源:GenericMsvValidator.java

示例3: _validate

import com.sun.msv.util.StringRef; //导入依赖的package包/类
/** performs the validation to the object specified in the constructor. */
private void _validate() throws SAXException {
    context.getNamespaceContext().startElement();
    
    // validate attributes
    target.serializeURIs(this);
    
    endNamespaceDecls();
    
    target.serializeAttributes(this);
    
    endAttributes();
    
    // validate content model
    target.serializeBody(this);
    writePendingText();
    
    context.getNamespaceContext().endElement();
    
    if(!acceptor.isAcceptState(null)) {
        // some elements are missing
        // report error
        StringRef ref = new StringRef();
        acceptor.isAcceptState(ref);
        context.reportEvent(target,ref.str);
    }
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:28,代码来源:MSVValidator.java

示例4: endAttributes

import com.sun.msv.util.StringRef; //导入依赖的package包/类
public void endAttributes() throws SAXException {
    if(!acceptor.onEndAttributes( null, null )) {
        // some required attributes are missing.
        // report a validation error
        // Note that we don't know which property of this object
        // causes this error.
        StringRef ref = new StringRef();
        StartTagInfo sti = new StartTagInfo(
            currentElementUri,currentElementLocalName,currentElementLocalName,
            emptyAttributes,this);
        acceptor.onEndAttributes( sti, ref );
        context.reportEvent(target,ref.str);
    }
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:15,代码来源:MSVValidator.java

示例5: writePendingText

import com.sun.msv.util.StringRef; //导入依赖的package包/类
private void writePendingText() throws SAXException {
    // assert(textBuf!=null);
    if(!acceptor.onText2( buf.toString(), this, null, null )) {
        // this text is invalid.
        // report an error
        StringRef ref = new StringRef();
        acceptor.onText2( buf.toString(), this, ref, null );
        context.reportEvent(target,ref.str);
    }
    
    if(buf.length()>1024)
        buf = new StringBuffer();
    else
        buf.setLength(0);
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:16,代码来源:MSVValidator.java

示例6: startElement

import com.sun.msv.util.StringRef; //导入依赖的package包/类
public void startElement( String uri, String local ) throws SAXException {
    writePendingText();
    
    context.getNamespaceContext().startElement();
    
    stack.push(acceptor);
    
    StartTagInfo sti = new StartTagInfo(uri,local,local,emptyAttributes,this);
    
    // we pass in an empty attributes, as there is just no way for us to
    // properly re-construct attributes. Fortunately, I know MSV is not using
    // attribute values, so this would work, but nevertheless this code is
    // ugly. This is one of the problems of the "middle" approach.
    Acceptor child = acceptor.createChildAcceptor( sti, null );
    if( child==null ) {
        // this element is invalid. probably, so this object is invalid
        // report an error
        StringRef ref = new StringRef();
        child = acceptor.createChildAcceptor( sti, ref );
        context.reportEvent(target,ref.str);
    }
    
    this.currentElementUri = uri;
    this.currentElementLocalName = local;
    
    acceptor = child;
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:28,代码来源:MSVValidator.java

示例7: childAsElementBody

import com.sun.msv.util.StringRef; //导入依赖的package包/类
private void childAsElementBody( Object o, ValidatableObject vo ) throws SAXException {
        String intfName = vo.getPrimaryInterface().getName();
        intfName = intfName.replace('$','.');
        
        // if the object implements the RIElement interface,
        // add a marker attribute to the dummy element.
        //
        // For example, if the object is org.acme.impl.FooImpl,
        // the dummy element will look like
        // <{DUMMY_ELEMENT_NS}org.acme.Foo
        //          {<URI of this element>}:<local name of this element>="" />
        // 
        // This extra attribute is used to validate wildcards.
//        AttributesImpl atts;
//        if(o instanceof RIElement) {
//            RIElement rie = (RIElement)o;
//            atts = new AttributesImpl();
//            atts.addAttribute(
//                rie.____jaxb_ri____getNamespaceURI(),
//                rie.____jaxb_ri____getLocalName(),
//                rie.____jaxb_ri____getLocalName(),  // use local name as qname
//                "CDATA",
//                "");    // we don't care about the attribute value
//        } else
//            atts = emptyAttributes;
            
        
        // feed a dummy element to the acceptor.
        StartTagInfo sti = new StartTagInfo(
            DUMMY_ELEMENT_NS,
            intfName,
            intfName/*just pass the local name as QName.*/,
            emptyAttributes,
            this );
        
            
        Acceptor child = acceptor.createChildAcceptor(sti,null);
        if(child==null) {
            // some required elements were missing. report errors
            StringRef ref = new StringRef();
            child = acceptor.createChildAcceptor(sti,ref);
            context.reportEvent(target,ref.str);
        }
        
        if(o instanceof RIElement) {
            RIElement rie = (RIElement)o;
            if(!child.onAttribute2(
                rie.____jaxb_ri____getNamespaceURI(),
                rie.____jaxb_ri____getLocalName(),
                rie.____jaxb_ri____getLocalName(),
                "",
                null, null, null ))
                
                // this object is not a valid member of the wildcard
                context.reportEvent(target,
                    Messages.format( Messages.INCORRECT_CHILD_FOR_WILDCARD,
                        rie.____jaxb_ri____getNamespaceURI(),
                        rie.____jaxb_ri____getLocalName() ));
        }
        
        child.onEndAttributes(sti,null);
        
        
        if(!acceptor.stepForward(child,null)) {
            // this can't be possible, as the dummy element was 
            // generated by XJC.
            throw new JAXBAssertionError();
        }

        
        // we need a separate validator instance to validate a child object
        context.validate(vo);
        
    }
 
开发者ID:nhrdl,项目名称:javacash,代码行数:75,代码来源:MSVValidator.java


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