if (fInDocument && !fInDTD && fCreateEntityRefNodes) {
if (!fDeferNodeExpansion) {
if (fDocumentImpl != null && fDocumentType != null) {
NamedNodeMap entities = fDocumentType.getEntities();
NodeImpl entity = (NodeImpl)entities.getNamedItem(name);
if (entity != null && entity.getFirstChild() == null) {
entity.setReadOnly(false, true);
Node child = fCurrentNode.getFirstChild();
while (child != null) {
Node copy = child.cloneNode(true);
entity.appendChild(copy);
child = child.getNextSibling();
}
entity.setReadOnly(true, true);
entities.setNamedItem(entity);
}
}
fCurrentNode = fCurrentNode.getParentNode();
}