OK, thanks for all the help.  Another question:
 
I call XPath.execute() and get back a NodeList.  I need to create a new Document and add the nodes from the NodeList to it.  I can't because I get a WRONG_DOCUMENT_ERR.  The spec says that error is returned "if a node is used in a different document than the one that created it (that doesn't support it)".  So I've looked for some way to clone the node or copy it into the Document, but I dont' see anything in the spec that allows that.
The simple question is:  how can I move elements from one document to another?
 
The philosophical question:  If XML is so simple, why is DOM so complicated?