Bah, magari ti può essere utile...

codice:
import org.w3c.dom.*;
import javax.xml.parsers.*;
import org.xml.sax.SAXException;
import java.io.*;

public class test {
  public static void main(String[] args) {
      String s = new String("<?xml version=\"1.0\"?><test><prova/></test>");
      try {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder parser = factory.newDocumentBuilder();
      Document d = parser.parse(new ByteArrayInputStream(s.getBytes()));
      // Facciamo qualche test...
      Element e = d.getDocumentElement();
      System.out.println(e.getTagName());
      NodeList e1 = e.getChildNodes();
      Node e2 = e1.item(0);
      System.out.println(e2.getNodeName());
      }
    catch (SAXException e) {
         }
    catch (IOException e) { 
         }
    catch (FactoryConfigurationError e) { 
         }
    catch (ParserConfigurationException e) { 
    }
   
  }

}