Overrides <code>endElement()</code> in
<code>org.xml.sax.helpers.DefaultHandler</code>,
which in turn implements <code>org.xml.sax.ContentHandler</code>.
Called for each start tag encountered.
488901
public void endElement(String namespaceUri,
                           String localName,
                           String qualifiedName)
            throws SAXException {
        currentElement = null;
        currentDepth--;
        String indentation = indent(-1);
        String closingElement = "</" + getName(localName, qualifiedName) + ">";
        write(currentlyInLeafElement ? closingElement : nl + indentation + closingElement);
        currentlyInLeafElement = false;
        this.currentElement = null;
        if (frozenArtifactResolver.artifactInheritsVersionFromParent() &&
            ARTIFACT_ID.equals(qualifiedName) &&
            currentDepth == 1) {
            logger.info("[Freezehandler]: Artifact version " + frozenArtifactResolver.artifactFrozenVersion());
            write(nl + indentation + "<" + VERSION + ">" + frozenArtifactResolver.artifactFrozenVersion() + "</" + VERSION + ">");
        }
        switch (qualifiedName) {
            case GROUP_ID:
            case ARTIFACT_ID:
            case PACKAGING:
            case RELATIVE_PATH:
            case "":
                break;
            case VERSION:
            default:
                this.currentGroupIdArtifactIdVersion = new GroupIdArtifactIdVersion();
        }
    }
1189875
public void endElement(String name) throws org.xml.sax.SAXException
    {
        endElement(null, null, name);
    }
381258
function endTagInText(p, token) {
    if (!p.fragmentContext && p.scriptHandler && token.tagName === $.SCRIPT)
        p.scriptHandler(p.document, p.openElements.current);

    p.openElements.pop();
    p.insertionMode = p.originalInsertionMode;
}
441455
@Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        stack.pop();
        final String parentNode = stack.peek();
        if (null != parentNode) {
            switch (parentNode) {
                case PROJECT:
                    if (null != qName) {
                        switch (qName) {
                            case GROUPID:
                                model.setGroupId(currentText.toString());
                                break;
                            case ARTIFACTID:
                                model.setArtifactId(currentText.toString());
                                break;
                            case VERSION:
                                model.setVersion(currentText.toString());
                                break;
                            case NAME:
                                model.setName(currentText.toString());
                                break;
                            case DESCRIPTION:
                                model.setDescription(currentText.toString());
                                break;
                            case URL:
                                model.setProjectURL(currentText.toString());
                                break;
                            default:
                                break;
                        }
                    }
                    break;
                case ORGANIZATION:
                    if (NAME.equals(qName)) {
                        model.setOrganization(currentText.toString());
                    } else if (URL.equals(qName)) {
                        model.setOrganizationUrl(currentText.toString());
                    }
                    break;
                case PARENT:
                    if (null != qName) {
                        switch (qName) {
                            case GROUPID:
                                model.setParentGroupId(currentText.toString());
                                break;
                            case ARTIFACTID:
                                model.setParentArtifactId(currentText.toString());
                                break;
                            case VERSION:
                                model.setParentVersion(currentText.toString());
                                break;
                            default:
                                break;
                        }
                    }
                    break;
                case LICENSE:
                    if (license != null) {
                        if (NAME.equals(qName)) {
                            license.setName(currentText.toString());
                        } else if (URL.equals(qName)) {
                            license.setUrl(currentText.toString());
                        }
                    }
                    break;
                case LICENSES:
                    if (LICENSE.equals(qName) && license != null) {
                        model.addLicense(license);
                    }
                    break;
                default:
                    break;
            }
        }
    }
1211876
private void processEndTag() throws XMLStreamException, TTException {
        mLevelInToShredder--;

        if (mInserted) {
            mInsertedEndTag = true;
        }

        if (mRemovedNode) {
            mRemovedNode = false;
        } else {

            // Move cursor to parent.
            if (mWtx.getNode().getDataKey() == mLastNodeKey) {
                /*
                 * An end tag must have been parsed immediately before and it
                 * must have been an empty element at the end of a subtree, thus
                 * move this time to parent node.
                 */
                assert mWtx.getNode().hasParent() && mWtx.getNode().getKind() == IConstants.ELEMENT;
                mWtx.moveTo(mWtx.getNode().getParentKey());
            } else {
                if (mWtx.getNode().getKind() == IConstants.ELEMENT) {
                    final ElementNode element = (ElementNode)mWtx.getNode();
                    if (element.hasFirstChild() && element.hasParent()) {
                        // It's not an empty element, thus move to parent.
                        mWtx.moveTo(mWtx.getNode().getParentKey());
                    }
                    // } else {
                    // checkIfLastNode(true);
                    // }
                } else if (((ITreeStructData)mWtx.getNode()).hasParent()) {
                    if (((ITreeStructData)mWtx.getNode()).hasRightSibling()) {
                        mWtx.moveTo(((ITreeStructData)mWtx.getNode()).getRightSiblingKey());
                        /*
                         * Means next event is an end tag in StAX reader, but
                         * something different where the Treetank transaction
                         * points to, which also means it has to be deleted.
                         */
                        mKeyMatches = -1;
                        mDelete = EDelete.ATBOTTOM;
                        deleteNode();
                    }
                    mWtx.moveTo(mWtx.getNode().getParentKey());
                }

            }

            mLastNodeKey = mWtx.getNode().getDataKey();

            // Move cursor to right sibling if it has one.
            if (((ITreeStructData)mWtx.getNode()).hasRightSibling()) {
                mWtx.moveTo(((ITreeStructData)mWtx.getNode()).getRightSiblingKey());
                mMovedToRightSibling = true;

                skipWhitespaces(mReader);
                if (mReader.peek().getEventType() == XMLStreamConstants.END_ELEMENT) {
                    /*
                     * Means next event is an end tag in StAX reader, but
                     * something different where the Treetank transaction points
                     * to, which also means it has to be deleted.
                     */
                    mKeyMatches = -1;
                    mDelete = EDelete.ATBOTTOM;
                    deleteNode();
                }
            } else {
                mMovedToRightSibling = false;
            }
        }
    }
541521
@SuppressWarnings("unchecked")
    public <T> T processElement(Element element) throws ConfigurationException
    {
        String namespace = $(element).namespaceURI();
        String tagName = $(element).tag();
        ElementHandler<?> handler = handlers.get(new HandlerId(namespace, tagName));
        if (handler != null)
        {
            Object o = handler.processElement(this, element);
            return (T) o;
        }
        throw new ConfigurationException("No Handler registered for element named [" + tagName
                    + "] in namespace: [" + namespace + "]");
    }
254236
protected void endNode(int node) throws org.xml.sax.SAXException
  {

    switch (m_dtm.getNodeType(node))
    {
    case DTM.DOCUMENT_NODE :
      this.m_contentHandler.endDocument();
      break;
    case DTM.ELEMENT_NODE :
      String ns = m_dtm.getNamespaceURI(node);
      if(null == ns)
        ns = "";
      this.m_contentHandler.endElement(ns,
                                         m_dtm.getLocalName(node),
                                         m_dtm.getNodeName(node));

      for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != nsn;
           nsn = m_dtm.getNextNamespaceNode(node, nsn, true))
      {
        // String prefix = m_dtm.getPrefix(nsn);
        String prefix = m_dtm.getNodeNameX(nsn);

        this.m_contentHandler.endPrefixMapping(prefix);
      }
      break;
    case DTM.CDATA_SECTION_NODE :
      break;
    case DTM.ENTITY_REFERENCE_NODE :
    {
      if (m_contentHandler instanceof LexicalHandler)
      {
        LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);

        lh.endEntity(m_dtm.getNodeName(node));
      }
    }
    break;
    default :
    }
  }
648387
public void endElement(String uri, String localName, String qName)
	    throws SAXException {
	// reduce the depth
	depth--;

	if (isExcluded()) {
	    // determine if exclusion ends with us
	    if (excludedDepth == depth)
	        excludedDepth = -1;

	    // either way, we have been excluded, so pass nothing through
	    return;
	}

	// if we're excepted (for now), include ourselves...
	if (isAccepted())
	    getContentHandler().endElement(uri, localName, qName);

	    if (DEBUG) {
		System.err.println("***   Closing tag: " + localName);
		System.err.println("***   acceptedDepths.size(): " + acceptedDepths.size());
		System.err.println("***   last accepted depth: " + ((Integer)acceptedDepths.peek()).intValue());
		System.err.println("***   depth: " + depth);
	    }

	// now, back off if we correspond to a "successful" start tag
        if (acceptedDepths.size() > 0 &&
		(((Integer)acceptedDepths.peek()).intValue()) == depth)
	    acceptedDepths.pop();
    }
739027
@Override
	public void endElement(String uri, String localName, String qName) throws SAXException {
		if(localName.equals("sessionid")) {
			String session = characters.toString();
			configs.put(session, session);

			log.info("Found Session '" + session + "'");	// with href: " + atts.getValue("href")
		}
		characters.setLength(0);
	}
450074
protected void endNode(int node) throws org.xml.sax.SAXException
  {
    super.endNode(node);
    if(DTM.ELEMENT_NODE == m_dtm.getNodeType(node))
    {
      m_transformer.getXPathContext().popCurrentNode();
    }
  }
593165
public void endElement(String uri, String name, String qName)
    {
        boolean isDebug = logger.isDebugEnabled();
        try
        {
            switch (getLiteralId(qName))
            {
                case MAPPING_REPOSITORY:
                    {
                        if (isDebug) logger.debug(" < " + tags.getTagById(MAPPING_REPOSITORY));
                        this.m_CurrentAttrContainer = null;
                        m_CurrentCLD = null;
                        break;
                    }
                case CLASS_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("  < " + tags.getTagById(CLASS_DESCRIPTOR));
                        m_CurrentCLD = null;
                        this.m_CurrentAttrContainer = null;
                        break;
                    }
                case OBJECT_CACHE:
                    {
                        if(m_CurrentAttrContainer != null)
                        {
                            if (isDebug) logger.debug("     < " + tags.getTagById(OBJECT_CACHE));
                        }
                        this.m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case CLASS_EXTENT:
                    {
                        break;
                    }
                case FIELD_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FIELD_DESCRIPTOR));
                        m_CurrentFLD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case REFERENCE_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(REFERENCE_DESCRIPTOR));
                        m_CurrentORD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case FOREIGN_KEY:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FOREIGN_KEY));
                        break;
                    }
                case COLLECTION_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(COLLECTION_DESCRIPTOR));
                        m_CurrentCOD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case INVERSE_FK:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(INVERSE_FK));
                        break;
                    }
                case ORDERBY :
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(ORDERBY));
                        break;
                    }
                case FK_POINTING_TO_THIS_CLASS:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FK_POINTING_TO_THIS_CLASS));
                        break;
                    }
                case FK_POINTING_TO_ITEMS_CLASS:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FK_POINTING_TO_ITEMS_CLASS));
                        break;
                    }
                case ATTRIBUTE:
                    {
                        if(m_CurrentAttrContainer != null)
                        {
                            if (isDebug) logger.debug("      < " + tags.getTagById(ATTRIBUTE));
                        }
                        break;
                    }
                case DOCUMENTATION:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(DOCUMENTATION));
                        break;
                    }
//                case SEQUENCE_MANAGER:
//                    {
//                        // currently not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(SEQUENCE_MANAGER));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
//                case CONNECTION_POOL:
//                    {
//                        // not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(CONNECTION_POOL));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
//                case JDBC_CONNECTION_DESCRIPTOR:
//                    {
//                        // not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(JDBC_CONNECTION_DESCRIPTOR));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
                case QUERY_CUSTOMIZER:
                    {
                        m_CurrentAttrContainer = m_CurrentCOD;
                        break;
                    }
                case INDEX_DESCRIPTOR:
                    {
                        m_CurrentCLD.getIndexes().add(m_CurrentIndexDescriptor);
                        m_CurrentIndexDescriptor = null;
                        break;
                    }
                case INDEX_COLUMN:
                    {
                        // ignore; all processing done in startElement
                        break;
                    }
                case INSERT_PROCEDURE:
                {
                    if (isDebug) logger.debug("    < " + tags.getTagById(INSERT_PROCEDURE));
                    m_CurrentCLD.setInsertProcedure((InsertProcedureDescriptor)m_CurrentProcedure);
                    m_CurrentProcedure = null;
                    break;
                }
                case UPDATE_PROCEDURE:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(UPDATE_PROCEDURE));
                        m_CurrentCLD.setUpdateProcedure((UpdateProcedureDescriptor)m_CurrentProcedure);
                        m_CurrentProcedure = null;
                        break;
                    }
                case DELETE_PROCEDURE:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(DELETE_PROCEDURE));
                        m_CurrentCLD.setDeleteProcedure((DeleteProcedureDescriptor)m_CurrentProcedure);
                        m_CurrentProcedure = null;
                        break;
                    }
                case CONSTANT_ARGUMENT:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(CONSTANT_ARGUMENT));
                        break;
                    }
                case RUNTIME_ARGUMENT:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(RUNTIME_ARGUMENT));
                        break;
                    }

                    // handle failure:
                default :
                    {
                        logger.debug("Ignoring unused Element " + qName);
                    }
            }
        }
        catch (Exception ex)
        {
            if(ex instanceof MetadataException) throw (MetadataException) ex;
            else throw new MetadataException("Exception when reading metadata information,"+
                    " please check your repository.xml file", ex);
        }
    }
133501
@Override
  public void startElement(String namespaceURI, String lName,
      String qName, Attributes attrs) throws SAXException {
    if (qName.equals(RULE)) {
      translations.clear();
      id = attrs.getValue("id");
      if (!(inRuleGroup && defaultOff)) {
        defaultOff = "off".equals(attrs.getValue("default"));
      }
      if (inRuleGroup && id == null) {
        id = ruleGroupId;
      }
      correctExamples = new ArrayList<>();
      incorrectExamples = new ArrayList<>();
    } else if (qName.equals(PATTERN)) {
      inPattern = true;
      String languageStr = attrs.getValue("lang");
      if (Languages.isLanguageSupported(languageStr)) {
        language = Languages.getLanguageForShortCode(languageStr);
      }
    } else if (qName.equals(TOKEN)) {
      setToken(attrs);
    } else if (qName.equals(TRANSLATION)) {
      inTranslation = true;
      String languageStr = attrs.getValue("lang");
      if (Languages.isLanguageSupported(languageStr)) {
        Language tmpLang = Languages.getLanguageForShortCode(languageStr);
        currentTranslationLanguage = tmpLang;
        if (tmpLang.equalsConsiderVariantsIfSpecified(motherTongue)) {
          translationLanguage = tmpLang;
        }
      }
    } else if (qName.equals(EXAMPLE)) {
      correctExample = new StringBuilder();
      incorrectExample = new StringBuilder();
      if (attrs.getValue(TYPE).equals("incorrect")) {
        inIncorrectExample = true;
      } else if (attrs.getValue(TYPE).equals("correct")) {
        inCorrectExample = true;
      } else if (attrs.getValue(TYPE).equals("triggers_error")) {
        throw new RuntimeException("'triggers_error' is not supported for false friend XML");
      }
    } else if (qName.equals(MESSAGE)) {
      inMessage = true;
      message = new StringBuilder();
    } else if (qName.equals(RULEGROUP)) {
      ruleGroupId = attrs.getValue("id");
      inRuleGroup = true;
      defaultOff = "off".equals(attrs.getValue(DEFAULT));
    }
  }
1285277
protected void startNode(Node node) throws org.xml.sax.SAXException
  {

//   TODO: <REVIEW>
//    A Serializer implements ContentHandler, but not NodeConsumer
//    so drop this reference to NodeConsumer which would otherwise
//    pull in all sorts of things
//    if (m_contentHandler instanceof NodeConsumer)
//    {
//      ((NodeConsumer) m_contentHandler).setOriginatingNode(node);
//    }
//    TODO: </REVIEW>
                
                if (node instanceof Locator)
                {
                        Locator loc = (Locator)node;
                        m_locator.setColumnNumber(loc.getColumnNumber());
                        m_locator.setLineNumber(loc.getLineNumber());
                        m_locator.setPublicId(loc.getPublicId());
                        m_locator.setSystemId(loc.getSystemId());
                }
                else
                {
                        m_locator.setColumnNumber(0);
      m_locator.setLineNumber(0);
                }

    switch (node.getNodeType())
    {
    case Node.COMMENT_NODE :
    {
      String data = ((Comment) node).getData();

      if (m_contentHandler instanceof LexicalHandler)
      {
        LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);

        lh.comment(data.toCharArray(), 0, data.length());
      }
    }
    break;
    case Node.DOCUMENT_FRAGMENT_NODE :

      // ??;
      break;
    case Node.DOCUMENT_NODE :
    
      break;
    case Node.ELEMENT_NODE :
      Element elem_node = (Element) node;
      {
          // Make sure the namespace node
          // for the element itself is declared
          // to the ContentHandler
          String uri = elem_node.getNamespaceURI();
          if (uri != null) {
              String prefix = elem_node.getPrefix();
              if (prefix==null)
                prefix="";
              this.m_contentHandler.startPrefixMapping(prefix,uri);              
          }
      }
      NamedNodeMap atts = elem_node.getAttributes();
      int nAttrs = atts.getLength();
      // System.out.println("TreeWalker#startNode: "+node.getNodeName());

      
      // Make sure the namespace node of
      // each attribute is declared to the ContentHandler
      for (int i = 0; i < nAttrs; i++)
      {
        final Node attr = atts.item(i);
        final String attrName = attr.getNodeName();
        final int colon = attrName.indexOf(':');
        final String prefix;

        // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
        if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
        {
          // Use "" instead of null, as Xerces likes "" for the 
          // name of the default namespace.  Fix attributed 
          // to "Steven Murray" <smurray@ebt.com>.
          if (colon < 0)
            prefix = "";
          else
            prefix = attrName.substring(colon + 1);

          this.m_contentHandler.startPrefixMapping(prefix,
                                                   attr.getNodeValue());
        }
        else if (colon > 0) {
            prefix = attrName.substring(0,colon);
            String uri = attr.getNamespaceURI();
            if (uri != null)
                this.m_contentHandler.startPrefixMapping(prefix,uri);
        }        
      }

      String ns = m_dh.getNamespaceOfNode(node);
      if(null == ns)
        ns = "";
      this.m_contentHandler.startElement(ns,
                                         m_dh.getLocalNameOfNode(node),
                                         node.getNodeName(),
                                         new AttList(atts, m_dh));
      break;
    case Node.PROCESSING_INSTRUCTION_NODE :
    {
      ProcessingInstruction pi = (ProcessingInstruction) node;
      String name = pi.getNodeName();

      // String data = pi.getData();
      if (name.equals("xslt-next-is-raw"))
      {
        nextIsRaw = true;
      }
      else
      {
        this.m_contentHandler.processingInstruction(pi.getNodeName(),
                                                    pi.getData());
      }
    }
    break;
    case Node.CDATA_SECTION_NODE :
    {
      boolean isLexH = (m_contentHandler instanceof LexicalHandler);
      LexicalHandler lh = isLexH
                          ? ((LexicalHandler) this.m_contentHandler) : null;

      if (isLexH)
      {
        lh.startCDATA();
      }
      
      dispatachChars(node);

      {
        if (isLexH)
        {
          lh.endCDATA();
        }
      }
    }
    break;
    case Node.TEXT_NODE :
    {
      //String data = ((Text) node).getData();

      if (nextIsRaw)
      {
        nextIsRaw = false;

        m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, "");
        dispatachChars(node);
        m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, "");
      }
      else
      {
        dispatachChars(node);
      }
    }
    break;
    case Node.ENTITY_REFERENCE_NODE :
    {
      EntityReference eref = (EntityReference) node;

      if (m_contentHandler instanceof LexicalHandler)
      {
        ((LexicalHandler) this.m_contentHandler).startEntity(
          eref.getNodeName());
      }
      else
      {

        // warning("Can not output entity to a pure SAX ContentHandler");
      }
    }
    break;
    default :
    }
  }
527232
public void endElement(String uri, String localName, String qName) 
    throws SAXException
    {
        if (logger.isLoggable(Level.FINER)) logger.entering(className, "endElement(String,String,String)");

        if (!previousObjects.isEmpty())
        {
            this.current = (JSONObject)this.previousObjects.pop();
        }
        else
        {
            this.current = null;
        }

        if (logger.isLoggable(Level.FINER)) logger.exiting(className, "endElement(String,String,String)");
    }
102340
public void setContentHandler(ContentHandler _saxHandler)
    {
        this.m_saxHandler = _saxHandler;
        if (m_lexHandler == null && _saxHandler instanceof LexicalHandler)
        {
            // we are not overwriting an existing LexicalHandler, and _saxHandler
            // is also implements LexicalHandler, so lets use it
            m_lexHandler = (LexicalHandler) _saxHandler;
        }
    }
449651
public void endElement(String namespaceURI, String localName, String qName)
        throws SAXException
    {
        if (m_firstTagNotEmitted)
        {
            flush();
            if (namespaceURI == null && m_firstElementURI != null)
                namespaceURI = m_firstElementURI;


            if (localName == null && m_firstElementLocalName != null)
                localName = m_firstElementLocalName;
        }
        
        m_handler.endElement(namespaceURI, localName, qName);
    }
340375
@Override
	public void startElement( String uri , String localName , String qName , Attributes attributes ) throws SAXException
    {
        super.startElement(uri,localName,qName,attributes);
        valueBuffer.setLength(0); // Clear value buffer
        nameStack.push(qName);
        String currentPath = StringTools.join(nameStack, "/");
        before(qName,currentPath,attributes);
    }