Ejemplo n.º 1
0
  /**
   * Process the current node in the default manner, expanding entities in its attributes and
   * processing its children re-entrantly.
   */
  public final void expandCurrentNode() {
    ActiveNode node = input.getActive();
    if (node == null) return;

    // Crock for PI comments:
    if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE && node.getNodeName().equals("--"))
      return;

    // No need to check for an entity; active ones use EntityHandler.
    if (input.hasActiveAttributes()) {
      ActiveElement oe = node.asElement();
      ActiveElement e = oe.editedCopy(expandAttrs(oe.getAttrList()), null);
      output.startNode(e);
      if (input.hasChildren()) {
        processChildren();
      }
      output.endElement(e.isEmptyElement() || e.implicitEnd());
    } else if (input.hasChildren()) {
      output.startNode(node);
      if (input.hasChildren()) processChildren();
      output.endNode();
    } else {
      output.putNode(node);
    }
  }