case DOCUMENT_TYPE_NODE: if (!owner.building) break; switch (childNodeType) { case COMMENT_NODE: case PROCESSING_INSTRUCTION_NODE: return; } break;
  private void checkMisc(DomNode child)  {    if (readonly && !owner.building)      {        throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,                        null, this, 0);      }    for (DomNode ctx = this; ctx != null; ctx = ctx.parent)      {        if (child == ctx)          {            throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR,                                      "can't make ancestor into a child",                                      this, 0);          }      }    DomDocument owner = (nodeType == DOCUMENT_NODE) ? (DomDocument) this :      this.owner;    DomDocument childOwner = child.owner;    short childNodeType = child.nodeType;        if (childOwner != owner)      {        // new in DOM L2, this case -- patch it up later, in reparent()        if (!(childNodeType == DOCUMENT_TYPE_NODE && childOwner == null))          {            throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR,                            null, child, 0);          }      }    // enforce various structural constraints    switch (nodeType)      {      case DOCUMENT_NODE:        switch (childNodeType)          {          case ELEMENT_NODE:          case PROCESSING_INSTRUCTION_NODE:          case COMMENT_NODE:          case DOCUMENT_TYPE_NODE:            return;          }        break;              case ATTRIBUTE_NODE:        switch (childNodeType)          {          case TEXT_NODE:          case ENTITY_REFERENCE_NODE:            return;          }        break;              case DOCUMENT_FRAGMENT_NODE:      case ENTITY_REFERENCE_NODE:      case ELEMENT_NODE:      case ENTITY_NODE:        switch (childNodeType)          {          case ELEMENT_NODE:          case TEXT_NODE:          case COMMENT_NODE:          case PROCESSING_INSTRUCTION_NODE:          case CDATA_SECTION_NODE:          case ENTITY_REFERENCE_NODE:            return;          }        break;      }    if (owner.checkingWellformedness)      {        throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR,                                  "can't append " +                                  nodeTypeToString(childNodeType) +                                  " to node of type " +                                  nodeTypeToString(nodeType),                        this, 0);      }  }