Logo Search packages:      
Sourcecode: jing-trang version File versions  Download package

void com::thaiopensource::validate::nvdl::SchemaImpl::Handler::parseRules ( Attributes  attributes  )  [inline, private]

Parse the rules element. Initializes the start mode the current mode the defaultSchemaType

Parameters:
attributes The rule element attributes.

Definition at line 504 of file SchemaImpl.java.

References com::thaiopensource::validate::nvdl::ActionSet::addNoResultAction(), com::thaiopensource::validate::nvdl::SchemaImpl::attributesSchema, com::thaiopensource::validate::nvdl::SchemaImpl::Handler::ModeData::currentMode, defaultSchemaType, com::thaiopensource::validate::nvdl::SchemaImpl::getModeAttribute(), getSchemaType(), com::thaiopensource::validate::nvdl::SchemaImpl::IMPLICIT_MODE_NAME, locator, com::thaiopensource::validate::nvdl::SchemaImpl::lookupCreateMode(), md, com::thaiopensource::validate::nvdl::SchemaImpl::startMode, and com::thaiopensource::validate::nvdl::SchemaImpl::WRAPPER_MODE_NAME.

Referenced by startElement().

                                                   {
      startMode = getModeAttribute(attributes, "startMode");
      // If not start mode specified we create an implicit mode.
      if (startMode == null) {
        startMode = lookupCreateMode(IMPLICIT_MODE_NAME);
        md.currentMode = startMode;
        // mark this implicit mode as not defined in the schema.
        startMode.noteDefined(null);
      }
      // Set the current location as the location the start mode is first used.
      startMode.noteUsed(locator);
      // if the schema should be used for validating only attributes
      // we need to create a wrapper that allows any element from any namespace
      // as the placeholder for the attributes we want to validate.
      if (attributesSchema) {
        Mode wrapper = lookupCreateMode(WRAPPER_MODE_NAME);
        // creates element actions - allow and set them for any namespace
        // the attributes will be validated further in the real schema start mode.
        ActionSet actions = new ActionSet();
        actions.addNoResultAction(new AllowAction(new ModeUsage(startMode, startMode)));
        wrapper.bindElement(NamespaceSpecification.ANY_NAMESPACE, NamespaceSpecification.DEFAULT_WILDCARD, actions);
        wrapper.noteDefined(null);
        // we use the wrapper mode as the start mode.
        startMode = wrapper;
      }
      // Get the default value for schema type if it is specified in rule/@schemaType.
      defaultSchemaType = getSchemaType(attributes);
    }


Generated by  Doxygen 1.6.0   Back to index