code: @Override
      public Node importAsNode(final InputStream stream, final boolean close) throws DescriptorImportException {
          try {
              // Empty contents? If so, no root Node
              if (stream.available() == 0) {
                  return null;
              }
  
              final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setNamespaceAware(true);
              final DocumentBuilder builder = factory.newDocumentBuilder();
              final Document doc = builder.parse(stream);
  
              final Element element = doc.getDocumentElement();
  
              final Node root = new Node(element.getNodeName());
  
              readRecursive(root, element);
              return root;
  
          } catch (final Exception e) {
              throw new DescriptorImportException("Could not import XML from stream", e);
          } finally {
              if (close) {
                  try {
                      stream.close();
                  } catch (final IOException ioe) {
                      try {
                          stream.close();
                      } catch (final IOException i) {
                          log.log(Level.WARNING, "Unclosable stream specified to be closed: {0}", stream);
                      }
                  }
              }
          }
      }
docs: {@inheritDoc}
  
  @see org.jboss.shrinkwrap.descriptor.spi.node.NodeImporter#importAsNode(java.io.InputStream, boolean)