private void updateImpl(List<OutputEventQueue.NodeEvent> nodeEvents) {
    if (nodeEvents.size() > 0) {
      for (DefaultMutableTreeNode node : myLastNodes) {
        if (node instanceof StructureNode) {
          ((StructureNode)node).refresh();
        }
      }
      myLastNodes.clear();
    }

    for (OutputEventQueue.NodeEvent event : nodeEvents) {
      event = intern(event);

      final DefaultMutableTreeNode node = myCurrentPath.getFirst();
      switch (event.getType()) {
        case OutputEventQueue.START_DOCUMENT:
          break;
        case OutputEventQueue.START_ELEMENT:
          final StructureNode child = new StructureNode(event);
          myLastNodes.add(child);

          final int index = getChildCount(node) - 1;
          node.insert(child, node.getChildCount() - 1);
          child.add(new DefaultMutableTreeNode(PENDING));

          myCurrentPath.addFirst(child);

          nodesWereInserted(node, new int[]{ index });
          break;

        case OutputEventQueue.END_ELEMENT:
          if (node instanceof MyRootNode) {
            // unknown xalan bug: start/end is sometimes unbalanced. should be fixed somewhere else...
            continue;
          }
        case OutputEventQueue.END_DOCUMENT:
          final DefaultMutableTreeNode c = myCurrentPath.removeFirst();
          final int childIndex = getChildCount(c) - 1;
          final int realChildIndex = c.getChildCount() - 1;
          if (realChildIndex >= 0) {
            final DefaultMutableTreeNode childNode = (DefaultMutableTreeNode)c.getChildAt(realChildIndex);
            assert childNode.getUserObject() == PENDING;
            c.remove(realChildIndex);
            nodesWereRemoved(c, new int[]{ childIndex }, new Object[]{ childNode });
          }
          break;

        case OutputEventQueue.TRACE_POINT:
        case OutputEventQueue.ATTRIBUTE:
        case OutputEventQueue.CHARACTERS:
        case OutputEventQueue.COMMENT:
        case OutputEventQueue.PI:
          final StructureNode ch = new StructureNode(event);
          myLastNodes.add(ch);

          final int i = getChildCount(node) - 1;
          node.insert(ch, node.getChildCount() - 1);
          nodesWereInserted(node, new int[]{ i });
      }
    }
  }
private void updateImpl(List<OutputEventQueue.NodeEvent> nodeEvents)