예제 #1
0
  protected Expression annealExpression(Expression exp) {
    // hook this ComplexTypeExp into the base type's restrictions list.

    final XMLSchemaReader reader = (XMLSchemaReader) this.reader;
    exp = super.annealExpression(exp);

    String refQName = startTag.getAttribute("base");
    if (refQName == null) {
      reader.reportError(XMLSchemaReader.ERR_MISSING_ATTRIBUTE, startTag.qName, "base");
      return exp;
      // recover by abandoning proper derivation processing
    }

    String[] r = reader.splitQName(refQName);
    if (r == null) {
      reader.reportError(XMLSchemaReader.ERR_UNDECLARED_PREFIX, refQName);
      return exp;
      // recover by abandoning proper derivation processing
    }

    if (reader.isSchemaNamespace(r[0]) && r[1].equals("anyType"))
      // derivation from anyType means this expression is the root of
      // derivation. So we don't have to connect this complex type to
      // the super class.
      return exp;

    ComplexTypeExp baseType =
        reader.getOrCreateSchema(r[0] /*uri*/).complexTypes.getOrCreate(r[1] /*local name*/);
    if (baseType == null)
      return exp; // recover by abandoning further processing of this declaration.

    reader.backwardReference.memorizeLink(baseType);

    /*        if( extension )
                baseType.extensions.exp = reader.pool.createChoice(
                                                baseType.extensions.exp,
                                                parentDecl.selfWType );
                // actual content model will be <baseTypeContentModel>,<AddedContentModel>
            else
                baseType.restrictions.exp = reader.pool.createChoice(
                                                baseType.restrictions.exp,
                                                parentDecl.selfWType );
    */
    // set other fields of the ComplexTypeExp.
    parentDecl.derivationMethod = extension ? ComplexTypeExp.EXTENSION : ComplexTypeExp.RESTRICTION;
    parentDecl.complexBaseType = baseType;

    return combineToBaseType(baseType, exp);
  }
 protected Expression annealExpression(Expression exp) {
   parentDecl.derivationMethod = ComplexTypeExp.EXTENSION;
   return reader.pool.createSequence(super.annealExpression(exp), getBody());
 }