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

AttributeActionSet com::thaiopensource::validate::nvdl::ValidatorImpl::processAttributeSection ( ModeUsage  modeUsage,
String  ns,
IntSet  indexSet,
Attributes  attributes 
) throws SAXException [inline, private]

Process an attributes section in a specific mode usage.

Parameters:
modeUsage The mode usage
ns The attribute section namespace
indexSet The indexes of the attributes in the given namespace
attributes All the attributes
Returns:
The set of attribute actions
Exceptions:
SAXException 

Definition at line 579 of file ValidatorImpl.java.

References com::thaiopensource::validate::nvdl::Hashset::add(), attributeNamespaceRejected, attributeSchemas, com::thaiopensource::validate::nvdl::Hashset::contains(), com::thaiopensource::validate::nvdl::ValidatorImpl::Section::context, currentSection, eh, filterAttributes(), filteredAttributes, com::thaiopensource::validate::nvdl::ModeUsage::getMode(), com::thaiopensource::validate::nvdl::AttributeActionSet::getReject(), com::thaiopensource::validate::nvdl::AttributeActionSet::getSchemas(), localizer, locator, and validateAttributes().

Referenced by processAttributes().

                              {
    // get the next mode from the mode usage depending on context
    Mode mode = modeUsage.getMode(currentSection.context);
    // get the attribute action set
    AttributeActionSet actions = mode.getAttributeActions(ns);
    // Check if we have a reject action and if we did not reported already 
    // the reject attribute error for this namespace
    if (actions.getReject() && !attributeNamespaceRejected) {
      // set the flag to avoid reporting this error again for the same namespace
      attributeNamespaceRejected = true;
      if (eh != null)
        eh.error(new SAXParseException(localizer.message("reject_attribute", ns),
                                       locator));
    }
    // get the eventual schemas and validate the attributes against them
    Schema[] schemas = actions.getSchemas();
    for (int j = 0; j < schemas.length; j++) {
      // if we already validated against this schema, skip it
      if (attributeSchemas.contains(schemas[j]))
        continue;
      // add the schema so that we will not validate again the same attributes against it
      attributeSchemas.add(schemas[j]);
      // if we do not computed the filtered attributes for this namespace, compute them
      if (filteredAttributes == null)
        filteredAttributes = filterAttributes(indexSet, attributes);
      // validate the filtered attributes with the schema
      validateAttributes(schemas[j], filteredAttributes);
    }
    // return the actions in case they are needed further.
    return actions;
  }


Generated by  Doxygen 1.6.0   Back to index