} else {
      // Import the node into doc so it has the correct owner document.
      dtd = doc.importNode(dtd, true);
      XmlDtd xmlDtd = (XmlDtd) NokogiriService.XML_DTD_ALLOCATOR.allocate(runtime, getNokogiriClass(runtime,
                      "Nokogiri::XML::DTD"));