Beispiel #1
0
    /** {@inheritDoc} */
    public void endElement(String uri, String localName, String rawName) throws SAXException {
      if (currentFObj == null) {
        throw new SAXException(
            "endElement() called for " + rawName + " where there is no current element.");
      } else if (!currentFObj.getLocalName().equals(localName)
          || !currentFObj.getNamespaceURI().equals(uri)) {
        throw new SAXException(
            "Mismatch: "
                + currentFObj.getLocalName()
                + " ("
                + currentFObj.getNamespaceURI()
                + ") vs. "
                + localName
                + " ("
                + uri
                + ")");
      }

      // fo:characters can potentially be removed during
      // white-space handling.
      // Do not notify the FOEventHandler.
      if (currentFObj.getNameId() != Constants.FO_CHARACTER) {
        currentFObj.endOfNode();
      }

      if (currentPropertyList != null
          && currentPropertyList.getFObj() == currentFObj
          && !builderContext.inMarker()) {
        currentPropertyList = currentPropertyList.getParentPropertyList();
      }

      if (currentFObj.getNameId() == Constants.FO_MARKER) {
        if (nestedMarkerDepth == 0) {
          builderContext.switchMarkerContext(false);
        } else {
          nestedMarkerDepth--;
        }
      }

      if (currentFObj.getParent() == null) {
        log.debug("endElement for top-level " + currentFObj.getName());
      }

      currentFObj = currentFObj.getParent();
    }