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

void com::thaiopensource::validate::nvdl::ValidatorImpl::startSection ( String  uri  )  throws SAXException [inline, private]

Start a new section on a given namespace. Called from startElement when we encounter an element whose namepsace does not match the current section namespace or if we get an element declared as a new section trigger in the NVDL script.

uri The new namespace.

Definition at line 646 of file ValidatorImpl.java.

References com::thaiopensource::validate::nvdl::Hashset::add(), com::thaiopensource::validate::nvdl::ValidatorImpl::Section::childPrograms, com::thaiopensource::validate::nvdl::Hashset::clear(), com::thaiopensource::validate::nvdl::Hashset::contains(), com::thaiopensource::validate::nvdl::ValidatorImpl::Section::context, currentSection, getContentHandler(), com::thaiopensource::validate::nvdl::ModeUsage::getMode(), com::thaiopensource::validate::nvdl::ActionSet::getNoResultActions(), com::thaiopensource::validate::nvdl::ActionSet::getResultAction(), com::thaiopensource::validate::nvdl::ValidatorImpl::Program::handler, initHandler(), com::thaiopensource::validate::nvdl::ValidatorImpl::Program::modeUsage, noResultActions, com::thaiopensource::validate::nvdl::NoResultAction::perform(), com::thaiopensource::validate::nvdl::ResultAction::perform(), and com::thaiopensource::validate::nvdl::ValidatorImpl::Section::validators.

Referenced by startElement().

    // creates a new section having the current section as parent section
    Section section = new Section(uri, currentSection);
    // get the programs of the current section
    Vector childPrograms = currentSection.childPrograms;
    // clear the current no result (validation) actions
    // iterates current section programs
    for (int i = 0, len = childPrograms.size(); i < len; i++) {
      Program program = (Program)childPrograms.elementAt(i);
      // get the mode usage for the program
      // and determine the use mode from the mode usage based on the current section context
      // and then get the element actions from that determined mode
      // that apply to the new namespace
      ActionSet actions = program.modeUsage.getMode(currentSection.context).getElementActions(uri);
      // check if we have a result action attach/unwrap
      // and perform it on the program handler and the new section
      ResultAction resultAction = actions.getResultAction();
      if (resultAction != null)
        resultAction.perform(program.handler, section);
      // get the no result (validate, allow, reject) actions
      NoResultAction[] nra = actions.getNoResultActions();
      for (int j = 0; j < nra.length; j++) {
        NoResultAction tem = nra[j];
        // if we did not encountered this action already then perform it on the
        // section and add it to the noResultActions list
        if (!noResultActions.contains(tem)) {
    // iterate the validators on the new section and set their content
    // handler to receive notifications and set the locator,
    // call start document, and bind the current namespace context. 
    for (int i = 0, len = section.validators.size(); i < len; i++)
    // store the new section as the current section
    currentSection = section;

Generated by  Doxygen 1.6.0   Back to index