public NodeInfo setSource(Source source) throws org.pdf4j.saxon.trans.XPathException {
if (source instanceof DOMSource) {
Node node = ((DOMSource)source).getNode();
String baseURI = source.getSystemId();
DocumentWrapper documentWrapper = new DocumentWrapper(node.getOwnerDocument(), baseURI, config);
NodeWrapper nodeWrapper = documentWrapper.wrap(node);
if (stripSpace) {
StrippedDocument sdoc = new StrippedDocument(documentWrapper, AllElementStripper.getInstance());
return sdoc.wrap(nodeWrapper);
} else {
return nodeWrapper;