Package com.sun.msv.util

Examples of com.sun.msv.util.StringPair


        this.namespaceURI    = namespaceURI;
        this.localName        = localName;
    }
   
    public StringPair toStringPair() {
        return new StringPair(namespaceURI,localName);
    }
View Full Code Here


        return new ExpressionPair(content, continuation);
    }

    /** computes a combined child content pattern and (,if possible,) its continuation. */
    public ExpressionPair get(Expression combinedPattern, StartTagInfo info) {
        StringPair sp = null;

        // check the cache
        if (combinedPattern.verifierTag != null) {
            OptimizationTag ot = (OptimizationTag)combinedPattern.verifierTag;
            sp = new StringPair(info.namespaceURI, info.localName);
            OptimizationTag.OwnerAndCont cache = (OptimizationTag.OwnerAndCont)ot.transitions.get(sp);

            if (cache != null) {
                // cache hit
                numElements = 1;
                result[0] = cache.owner;
                return new ExpressionPair(cache.owner.contentModel.getExpandedExp(pool), cache.continuation);
            }
        }

        ExpressionPair r = (ExpressionPair)get(combinedPattern, info, true);

        if (numElements == 1) {
            // only one element matchs this tag name. cache this result
            OptimizationTag ot = (OptimizationTag)combinedPattern.verifierTag;
            if (ot == null)
                combinedPattern.verifierTag = ot = new OptimizationTag();

            if (sp == null)
                sp = new StringPair(info.namespaceURI, info.localName);

            ot.transitions.put(sp, new OptimizationTag.OwnerAndCont(result[0], r.continuation));
        }
        return r;
    }
View Full Code Here

        final RELAXNGReader reader = (RELAXNGReader)this.reader;
        String typeName = startTag.getCollapsedAttribute("type");
       
        Datatype type;
       
        StringPair typeFullName;
       
        if(typeName==null) {
            try {
                // defaults to built-in token type.
                type = reader.resolveDataTypeLibrary("").createDatatype("token");
                typeFullName = new StringPair("","token");
            } catch( DatatypeException e ) {
                // since token is the built-in datatype,
                // this can't happen
                e.printStackTrace();
                throw new InternalError();
            }
        } else {
            type = reader.resolveDataType(typeName);
            typeFullName = new StringPair(reader.datatypeLibURI,typeName);
        }
       
        Object value = type.createValue(text.toString(),reader);
        if( value==null ) {
            // this is not a good value for this type.
View Full Code Here

        if( fixed!=null )
            // TODO: is this 'fixed' value should be added through enumeration facet?
            // TODO: check if content model is a simpleType.
            contentType = reader.pool.createValue(
                com.sun.msv.datatype.xsd.TokenType.theInstance,
                new StringPair("","token"), fixed ); // emulate RELAX NG built-in token type
       
       
        ElementDeclExp decl;
        if( isGlobal() ) {
            decl = reader.currentSchema.elementDecls.getOrCreate(name);
View Full Code Here

   
    protected Expression makeExpression() {
        if("preserve".equals(startTag.getAttribute("whiteSpace")))
            return reader.pool.createValue(
                StringType.theInstance,
                new StringPair("","string"),
                text.toString() );
        else
            return reader.pool.createValue(
                TokenType.theInstance,
                new StringPair("","token"),
                WhiteSpaceProcessor.collapse(text.toString()) );
       
        // masquerade RELAX NG built-in datatypes
    }
View Full Code Here

            // recover from error by assuming anyString.
            return Expression.anyString;
        } else {
            return reader.pool.createData(
                ((TREXGrammarReader)reader).resolveDatatype(typeName),
                new StringPair("",typeName) );
        }
    }
View Full Code Here

                    // for example. So just degrade and assume token here.
                   
                    // I know  this is a sloppy work
                    contentType = reader.pool.createValue(
                        com.sun.msv.datatype.xsd.TokenType.theInstance,
                        new StringPair("","token"), // emulate RELAX NG built-in "token" type
                        fixed );
                }
            }
           
            if( "prohibited".equals(use) )
View Full Code Here

    public Object onAnyName( AnyNameClass nc ) {
        names.add( pairForAny );
        return null;
    }
    public Object onSimple( SimpleNameClass nc ) {
        names.add( new StringPair( nc.namespaceURI, nc.localName ) );
        return null;
    }
View Full Code Here

    public Object onSimple( SimpleNameClass nc ) {
        names.add( new StringPair( nc.namespaceURI, nc.localName ) );
        return null;
    }
    public Object onNsName( NamespaceNameClass nc ) {
        names.add( new StringPair( nc.namespaceURI, MAGIC ) );
        return null;
    }
View Full Code Here

        final String localName = startTag.getCollapsedAttribute("type");
        if( localName==null ) {
            reader.reportError( RELAXNGReader.ERR_MISSING_ATTRIBUTE, "data", "type" );
        } else {
            // create a type incubator
            baseTypeName = new StringPair( reader.datatypeLibURI, localName );
            try {
                typeBuilder = reader.getCurrentDatatypeLibrary().createDatatypeBuilder(localName);
            } catch( DatatypeException dte ) {
                reader.reportError( RELAXNGReader.ERR_UNDEFINED_DATATYPE_1, localName, dte.getMessage() );
            }
View Full Code Here

TOP

Related Classes of com.sun.msv.util.StringPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.