When a query returns something that is not an element, RemoteXMLResource.getContentAsDOM throws an exception because the text is not a valid XML _Document_. It is a valid XML Node, but not a document. This happens, for example, with //@a or //comment().


It seems to me that getContentAsDOM should still work with these XML fragments, as signature-wise the method returns a Node and not a Document.


Now I have no knowledge of a way of creating  a Node from text, so I’m not sure there is a good Java answer, but am submitting this nonetheless.



Gil Tayar


Chief Technology Officer

Business: +972 (3) 766 1806

Mobile:    +972 (54) 634 4457