Package com.sun.msv.grammar.trex

Examples of com.sun.msv.grammar.trex.ElementPattern


        ReferenceExp r = new ReferenceExp("lax");
        r.exp = pool.createZeroOrMore(pool.createChoice(
            pool.createAnyString(),
            pool.createChoice(
                pool.createAttribute(NameClass.ALL),
                new ElementPattern(NameClass.ALL,r))));
       
       
        this.exp = pool.createChoice( this.exp,
            new ElementPattern(rest,r));           
    }
View Full Code Here


     * While the other ordinary {@link ElementExp}s can be also used,
     * this {@link ElementExp} allows the grammar to be serialized without
     * too much recursion.
     */
    public ElementPattern createElement( NameClass nc, Expression contentModel ) {
        ElementPattern p = new ElementPattern(nc,contentModel);
        elementContents.put(p,contentModel);
        return p;
    }
View Full Code Here

        xsdSchema = new XMLSchemaSchema( XMLSchemaNamespace, grammar );
        // since we might parse the schema-for-schema, we cannot mark
        // this schema as "already defined."
//        markSchemaAsDefined(xsdSchema);
   
        ElementPattern e = new ElementPattern( NameClass.ALL, Expression.nullSet );
        e.contentModel =
            pool.createMixed(
                pool.createZeroOrMore(
                    pool.createChoice(
                        pool.createAttribute( NameClass.ALL ),
View Full Code Here

*
* @author <a href="mailto:kohsuke.kawaguchi@eng.sun.com">Kohsuke KAWAGUCHI</a>
*/
public class ElementState extends NameClassAndExpressionState {
    protected Expression annealExpression( Expression contentModel ) {
        ElementPattern e = new ElementPattern( nameClass, contentModel );
        reader.setDeclaredLocationOf(e);
        return e;
    }
View Full Code Here

                contentModel = grammar.pool.createSequence( contentModel, exp );
            }
        }
           
        ReferenceExp er = grammar.namedPatterns.getOrCreate(elementName);
        er.exp = new ElementPattern(
            getNameClass(elementName,false),
            grammar.pool.createSequence(contentModel,
                (Expression)elementDecls.get(elementName) ) );
       
        // copy the declared location
View Full Code Here

       
        if( process.equals("skip") ) {
            // "skip" can be expanded now.
            NameClass nc = getNameClass(namespace,currentSchema);
           
            ElementPattern ep = new ElementPattern(nc,Expression.nullSet);
               
            ep.contentModel =
                // <mixed><zeroOrMore><choice><attribute /><element /></choice></zeroOrMore></mixed>
                reader.pool.createMixed(
                    reader.pool.createZeroOrMore(
                        reader.pool.createChoice(
                            ep,
                            reader.pool.createAttribute(nc)
                        )
                    )
                );
               
            // minOccurs/maxOccurs is processed through interception
            return ep;
        }
       
        // "lax"/"strict" has to be back-patched later.
        final ReferenceExp exp = new ReferenceExp("any("+process+":"+namespace+")");
        reader.addBackPatchJob( new GrammarReader.BackPatch(){
            public State getOwnerState() { return AnyElementState.this; }
            public void patch() {

                if( !process.equals("lax")
                &&  !process.equals("strict") )  {
                    reader.reportError( XMLSchemaReader.ERR_BAD_ATTRIBUTE_VALUE, "processContents", process );
                    exp.exp = Expression.nullSet;
                    return;
                }
               
                exp.exp = Expression.nullSet;
                NameClass nc = getNameClass(namespace,currentSchema);
                Iterator itr;
                itr = reader.grammar.iterateSchemas();
                while( itr.hasNext() ) {
                    XMLSchemaSchema schema = (XMLSchemaSchema)itr.next();
                    // nc is built by using NamespaceNameClass.
                    // "strict" allows global element declarations of
                    // specified namespaces.
                    if(nc.accepts( schema.targetNamespace, NameClass.LOCALNAME_WILDCARD ))
                        // schema.topLevel is choices of globally declared elements.
                        exp.exp = reader.pool.createChoice( exp.exp, schema.topLevel );
                }
               
                if( !process.equals("lax") )
                    return;    // if processContents="strict", the above is fine.
               
                // if "lax", we have to add an expression to
                // match other elements.
                NameClass laxNc = createLaxNameClass( nc,
                    new XMLSchemaReader.RefResolver() {
                        public ReferenceContainer get( XMLSchemaSchema schema ) {
                            return schema.elementDecls;
                        }
                    });
               
                exp.exp = reader.pool.createChoice(
                    new ElementPattern( laxNc,
                        reader.pool.createMixed(
                            reader.pool.createZeroOrMore(
                                reader.pool.createChoice(
                                    reader.pool.createAttribute(NameClass.ALL),
                                    exp)))),
View Full Code Here

      When processing Y->Z, we don't want that.
      */
     
      Expression body = exp.contentModel.visit(this);
      if(body==exp.contentModelreturn exp;
      else  return new ElementPattern( exp.getNameClass(), body );
    }
View Full Code Here

      When processing Y->Z, we don't want that.
      */
     
      Expression body = visitXMLItemContent(exp);
      if(body==exp.contentModelreturn exp;
      else  return new ElementPattern( exp.getNameClass(), body );
    }
View Full Code Here

        if(body==exp.contentModelreturn exp;  // this item is not modified.
        else
          // body of this element is modified.
          // since this ElementExp might be shared,
          // we need to create a fresh ElementExp.
          return new ElementPattern(exp.getNameClass(),body);
      }
    };
  }
View Full Code Here

      */
      Expression body = exp.contentModel.visit(this);
     
      if(body==exp.contentModelreturn exp;
     
      return new ElementPattern( exp.getNameClass(), body );
    }
View Full Code Here

TOP

Related Classes of com.sun.msv.grammar.trex.ElementPattern

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.