/* (non-Javadoc)
@see tuwien.auto.calimero.xml.XMLWriter#endElement()
548184
public void endElement() throws KNXMLException
	{
		if (layout.empty())
			throw new KNXIllegalStateException("no elements to end");
		try {
			((Tag) layout.pop()).endTag();
			if (layout.empty())
				w.flush();
		}
		catch (final IOException e) {
			throw new KNXMLException(e.getMessage());
		}
	}
772382
void appendEndElement()
  {
    // pop up the stacks

    if (previousSiblingWasParent)
      nodes.writeEntry(previousSibling, 2, NULL);

    // Pop parentage
    previousSibling = currentParent;
    nodes.readSlot(currentParent, gotslot);
    currentParent = gotslot[1] & 0xFFFF;

    // The element just being finished will be
    // the previous sibling for the next operation
    previousSiblingWasParent = true;

    // Pop a level of namespace table
    // namespaceTable.removeLastElem();
  }
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)");
    }
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);
    }
696870
public void endDocument() throws SAXException
  {
    super.endDocument();

    // Add a NULL entry to the end of the node arrays as
    // the end indication.
    m_exptype.addElement(NULL);
    m_parent.addElement(NULL);
    m_nextsib.addElement(NULL);
    m_firstch.addElement(NULL);

    // Set the cached references after the document is built.
    m_extendedTypes = m_expandedNameTable.getExtendedTypes();
    m_exptype_map = m_exptype.getMap();
    m_nextsib_map = m_nextsib.getMap();
    m_firstch_map = m_firstch.getMap();
    m_parent_map  = m_parent.getMap();
  }
1213876
@Override
    public void endElement(String uri, String name, String qName) {
	setContent(content.toString().trim());
	content = new StringBuffer();
	inside = "";
	/*
	 * if(tag!=null && tag.getName().equalsIgnoreCase("input")) {
	 * print.ln(tag.getName()+"-"+att.getName()+":"+inside+"-"+insideTag+"-"+insideAtt);
	 * 
	 * }
	 */
	if (qName.equals("tag")) endTag();
	else if (qName.equals("attribute")) endAtt();
	else if (qName.equals("script")) endScript();

    }
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;
            }
        }
    }
1329976
protected final void readToEndElement(XMLEventReader eventReader, StartElement event)
            throws XMLStreamException {
        final Deque<QName> elementStack = new LinkedList<QName>();
        elementStack.push(event.getName());

        while (!elementStack.isEmpty()) {
            final XMLEvent nextEvent = eventReader.nextEvent();
            if (nextEvent.isStartElement()) {
                final StartElement startElement = nextEvent.asStartElement();
                elementStack.push(startElement.getName());
            } else if (nextEvent.isEndElement()) {
                final QName lastStart = elementStack.pop();
                final EndElement endElement = nextEvent.asEndElement();
                if (!lastStart.equals(endElement.getName())) {
                    throw new XMLStreamException(
                            "Invalid XML Structure, expected EndElement "
                                    + lastStart
                                    + " but found EndElment "
                                    + endElement.getName());
                }
            }
        }
    }
123777
@Override
    public void endElement(CMLStack xpath, String uri, String name, String raw) {
        if (name.equals("molecule")) {
            //			System.out.println("Ending element mdmolecule");
            // add chargeGroup, and then delete them
            if (currentChargeGroup != null) {
                if (currentMolecule instanceof MDMolecule) {
                    ((MDMolecule) currentMolecule).addChargeGroup(currentChargeGroup);
                } else {
                    logger.error("Need to store a charge group, but the current molecule is not a MDMolecule!");
                }
                currentChargeGroup = null;
            } else

            // add chargeGroup, and then delete them
            if (currentResidue != null) {
                if (currentMolecule instanceof MDMolecule) {
                    ((MDMolecule) currentMolecule).addResidue(currentResidue);
                } else {
                    logger.error("Need to store a residue group, but the current molecule is not a MDMolecule!");
                }
                currentResidue = null;
            } else {
                //				System.out.println("OK, that was the last end mdmolecule");
                super.endElement(xpath, uri, name, raw);
            }
        } else if ("atomArray".equals(name)) {
            if (xpath.length() == 2 && xpath.endsWith("molecule", "atomArray")) {
                storeAtomData();
                newAtomData();
            } else if (xpath.length() > 2 && xpath.endsWith("cml", "molecule", "atomArray")) {
                storeAtomData();
                newAtomData();
            }
        } else if ("bondArray".equals(name)) {
            if (xpath.length() == 2 && xpath.endsWith("molecule", "bondArray")) {
                storeBondData();
                newBondData();
            } else if (xpath.length() > 2 && xpath.endsWith("cml", "molecule", "bondArray")) {
                storeBondData();
                newBondData();
            }
        } else if ("scalar".equals(name)) {
            //Residue number
            if ("md:resNumber".equals(DICTREF)) {
                int myInt = Integer.parseInt(currentChars);
                currentResidue.setNumber(myInt);
            }
            //ChargeGroup number
            else if ("md:cgNumber".equals(DICTREF)) {
                int myInt = Integer.parseInt(currentChars);
                currentChargeGroup.setNumber(myInt);
            }
        } else {
            super.endElement(xpath, uri, name, raw);
        }
    }
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;
            }
        }
    }
957108
def endElement(self, name, value, connection):
        """"""
        if name == 'NextRecordName':
            self.next_record_name = value
        elif name == 'NextRecordType':
            self.next_record_type = value
        else:
            return ResultSet.endElement(self, name, value, connection)
98812
private function _endElement($parser, $name) {
        // end tag was found...
        $parserid = (int) $parser;
        $this->_xmltree[$parserid] = substr($this->_xmltree[$parserid],0, strlen($this->_xmltree[$parserid]) - (strlen($name) + 1));
    }
950852
@Override
	public void endElement(String uri, String localName, String name) throws SAXException
    {
        super.endElement(uri, localName, name);
        String currentPath = StringTools.join(nameStack, "/");
        onNode(name,currentPath);
        nameStack.pop();
     }
679386
public void endElement (String qName)
    throws SAXException
    {
                // If we're not doing Namespace
                // processing, dispatch this quickly.
    if (!namespaces) {
        if (contentHandler != null) {
        contentHandler.endElement("", "", qName.intern());
        }
        return;
    }

                // Split the name.
    String names[] = processName(qName, false, false);
    if (contentHandler != null) {
        contentHandler.endElement(names[0], names[1], names[2]);
        Enumeration prefixes = nsSupport.getDeclaredPrefixes();
        while (prefixes.hasMoreElements()) {
        String prefix = (String)prefixes.nextElement();
        contentHandler.endPrefixMapping(prefix);
        }
    }
    nsSupport.popContext();
    }
274972
public void writeElement(String name, Object text)
  {
    startElement(name);
    writeText(text);
    endElement(name);
  }
641180
def _is_end(event, node, tagName): # pylint: disable=invalid-name
    """"""

    return event == pulldom.END_ELEMENT and node.tagName == tagName
611154
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
    {
        if (localName.equalsIgnoreCase(TABLE))
        {
            if (startTable)
                if (m_record.getEditMode() == DBConstants.EDIT_ADD)
                {
                    try {
                        m_record.add();
                    } catch (DBException e) {
                        e.printStackTrace();
                    }
                }
            startTable = false;
        }
    }