/** Expand a single entity. */
 public void expandEntity(ActiveEntity n, Output dst) {
   NodeList value = n.getValueNodes(this);
   if (value == null) {
     dst.putNode(n);
   } else {
     Copy.copyNodes(value, dst);
   }
 }
 /** Expand an entity reference. */
 public void expandEntityRef(EntityReference n, Output dst) {
   String name = n.getNodeName();
   NodeList value = Index.getIndexValue(this, name);
   if (value == null) {
     dst.putNode(n);
   } else {
     Copy.copyNodes(value, dst);
   }
 }
 public void expandNodes(ActiveNodeList nl, Output dst) {
   int len = nl.getLength();
   for (int i = 0; i < len; ++i) {
     ActiveNode n = nl.activeItem(i);
     if (n.getNodeType() == Node.ENTITY_NODE) {
       expandEntity((ActiveEntity) n, dst);
     } else if (n.getNodeType() == Node.ENTITY_REFERENCE_NODE) {
       expandEntityRef((EntityReference) n, dst);
     } else {
       dst.putNode(n);
     }
   }
 }