Document document = dbf.newDocumentBuilder().newDocument();
DocumentFragment fragment = document.createDocumentFragment();
Element element = document.createElementNS("urn:test", "ns:root");
element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:ns", "urn:test");
fragment.appendChild(element);
assertNull(fragment.lookupNamespaceURI("ns"));
}
}