Package com.sun.msv.grammar

Examples of com.sun.msv.grammar.NameClass


    public void connect(ExpressionPool pool, Grammar[] others) {
        found = null;
        super.connect(pool,others);
       
        NameClass rest = new DifferenceNameClass(namespaces,found).simplify();
        // build up lax content model
        ReferenceExp r = new ReferenceExp("lax");
        r.exp = pool.createZeroOrMore(pool.createChoice(
            pool.createAnyString(),
            pool.createChoice(
View Full Code Here


               
                StringPair _en = elementName;
                IDAttMap _curAtts = curAtts;
                ElementExp _curElm = curElm;
               
                NameClass nc = exp.getNameClass();
                if(nc instanceof SimpleNameClass) {
                    elementName = new StringPair((SimpleNameClass)nc);
                    curAtts = (IDAttMap)name2value.get(elementName);    // maybe null.
                } else
                    elementName = null;
View Full Code Here

        // test that the competing elements also has the same default values.
        itr = elements.iterator();
        while(itr.hasNext()) {
            final ElementExp eexp = (ElementExp)itr.next();
           
            NameClass nc = eexp.getNameClass();
            if(!(nc instanceof SimpleNameClass)) {
                // if the element has a complex name class,
                // it cannot have a default attribute value.
                // (this is checked within the first pass.
                // so in this case, we just need to make sure that
                // any competing elements do not have defaulted attributes.
                Iterator jtr = name2value.entrySet().iterator();
                while(jtr.hasNext()) {
                    Map.Entry e = (Map.Entry)jtr.next();
                    if(nc.accepts((StringPair)e.getKey())) {
                        // this element competes with this eexp.
                        DefAttMap defAtts = (DefAttMap)e.getValue();
                        if(defAtts.defaultAttributes.size()>0) {
                            // TODO: what should the error message be?
                            reportCompError(
View Full Code Here

    /**
     * performs final wrap-up and returns a fully created NameClass object
     * that represents this element.
     */
    protected NameClass annealNameClass( NameClass nameClass ) {
        NameClass r = getMainNameClass();
        if( nameClass!=null )
            r = new DifferenceNameClass( r, nameClass );
        return r;
    }
View Full Code Here

            NameClassAndExpression oldExp ) {
           
            if(checker.check( newExp.getNameClass(), oldExp.getNameClass() )) {
                // two attributes/elements collide
               
                NameClass intersection = NameClass.intersection(
                    newExp.getNameClass(), oldExp.getNameClass() );
                   
                reader.reportError(
                    new Locator[]{
                        reader.getDeclaredLocationOf(errorContext),    // the parent element
                        reader.getDeclaredLocationOf(newExp),
                        reader.getDeclaredLocationOf(oldExp)},
                    getErrorMessage(),
                    new Object[]{intersection.toString()} );
            }
        }
View Full Code Here

            return local;
       
        // assert(children.length>0)
           
        // compute the intersection of wildcard.
        NameClass target = children[0].getName();
        for( int i=1; i<children.length; i++ )
            target = NameClass.intersection(target,children[i].getName());
           
        if( local!=null )
            return new AttributeWildcard(
View Full Code Here

            return new NotNameClass(
                new ChoiceNameClass(
                    new NamespaceNameClass(currentSchema.targetNamespace),
                    new NamespaceNameClass("")) );
       
        NameClass choices=null;
       
        StringTokenizer tokens = new StringTokenizer(namespace);
        while( tokens.hasMoreTokens() ) {
            String token = tokens.nextToken();
           
            NameClass nc;
            if( token.equals("##targetNamespace") )
                nc = new NamespaceNameClass(currentSchema.targetNamespace);
            else
            if( token.equals("##local") )
                nc = new NamespaceNameClass("");
View Full Code Here

        while( itr.hasNext() ) {
            XMLSchemaSchema schema = (XMLSchemaSchema)itr.next();
            if(allowedNc.accepts( schema.targetNamespace, NameClass.LOCALNAME_WILDCARD )) {
                ReferenceExp[] refs = res.get(schema).getAll();
                for( int i=0; i<refs.length; i++ ) {
                    NameClass name = getNameClassFrom(refs[i]);
                           
                    if(!(name instanceof SimpleNameClass ))
                        // assertion failed.
                        // XML Schema's element declaration is always simple name.
                        throw new Error();
View Full Code Here

            if( attribute && step.indexOf(':')<0 )
                qn[0] = "";    // if this is an attribute and step is NCName,
                            // then its namespace URI is "", rather than the
                            // default namespace.
           
            NameClass nc;
           
            // TODO: NCName test.
            if( qn[1].equals("*") )        nc = new NamespaceNameClass(qn[0]);
            else                        nc = new SimpleNameClass(qn[0],qn[1]);
           
View Full Code Here

                    }
                }
                else
                if( exp instanceof ElementExp ) {
                    ElementExp eexp = (ElementExp)exp;
                    NameClass nc = eexp.getNameClass();
                   
                    if( nc instanceof SimpleNameClass
                     && !name2exp.containsKey( ((SimpleNameClass)nc).localName ) )
                        name2exp.put( ((SimpleNameClass)nc).localName, exp );
                    else {
View Full Code Here

TOP

Related Classes of com.sun.msv.grammar.NameClass

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.