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

void com::thaiopensource::validate::nvdl::ValidatorImpl::startElement ( String  uri,
String  localName,
String  qName,
Attributes  attributes 
) throws SAXException [inline]

startElement callback.

Parameters:
uri The element namespace.
localName The element local name.
qName The element qualified name.
attributes The attributes for this element.

Definition at line 401 of file ValidatorImpl.java.

References com::thaiopensource::validate::nvdl::ValidatorImpl::Section::activeHandlers, activeHandlersAttributeIndexSets, com::thaiopensource::validate::nvdl::ValidatorImpl::Section::context, com::thaiopensource::validate::nvdl::ValidatorImpl::Section::contextDependent, currentSection, com::thaiopensource::validate::nvdl::ValidatorImpl::Section::depth, elementsLocalNameStack, filterAttributes(), com::thaiopensource::validate::nvdl::ValidatorImpl::Section::ns, com::thaiopensource::validate::nvdl::ValidatorImpl::Section::placeholderHandlers, processAttributes(), startSection(), and trigger().

                              {
    
    // if we have a different namespace than the current section namespace
    // or there's an applicable trigger
    // then we start a new section on the new namespace.
    if (!uri.equals(currentSection.ns)
        || trigger(uri, localName, (String)elementsLocalNameStack.peek()))
      startSection(uri);
    
    elementsLocalNameStack.push(localName);
    // increase the depth in the current section as we have a new element
    currentSection.depth++;
    // if the current section contains context dependent mode usages then
    // we record the local elements in a stack as they form the current path
    // that determines the context
    if (currentSection.contextDependent)
      currentSection.context.push(localName);
    // check if we need to filter attributes or not
    // and process attributes, eventually validating attribute sections
    boolean transformAttributes = processAttributes(attributes);
    // iterate the active session handlers and call start element on them
    for (int i = 0, len = currentSection.activeHandlers.size(); i < len; i++) {
      ContentHandler handler = (ContentHandler)(currentSection.activeHandlers.elementAt(i));
      handler.startElement(uri, localName, qName,
                           transformAttributes
                           // if we need to filter attributes keep the ones the handler is interested in.
                           ? filterAttributes((IntSet)activeHandlersAttributeIndexSets.elementAt(i),
                                              attributes)
                           // otherwise just pass all the attributes
                           : attributes);
    }
    if (currentSection.depth == 1 && currentSection.placeholderHandlers.size() > 0) {
      AttributesImpl atts = new AttributesImpl();
      atts.addAttribute("", "ns", "ns", "", uri);
      atts.addAttribute("", "localName", "localName", "", localName);
      for (int i = 0, len = currentSection.placeholderHandlers.size(); i < len; i++) {
        ContentHandler handler = (ContentHandler)(currentSection.placeholderHandlers.elementAt(i));
        handler.startPrefixMapping("", "http://purl.oclc.org/dsdl/nvdl/ns/instance/1.0");
        handler.startElement("http://purl.oclc.org/dsdl/nvdl/ns/instance/1.0", "placeholder", "placeholder", atts);
      }
    }    
  }


Generated by  Doxygen 1.6.0   Back to index