title: Apache Camel and Xpath
body: <p>I am having trouble with xpath expressions in Apache Camel:</p>
  
  <pre><code>  Object obj =  exchange.getIn().getBody(Document.class);
    String tag = XPathBuilder.xpath("name(//*)").resultType(String.class).evaluate(exchange.getContext(),obj,String.class);
  </code></pre>
  
  <p>but on exit, I get the following error:</p>
  
  <blockquote>
    <p>org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: org.w3c.dom.Document with value [Body is instance of java.io.InputStream] due org.xml.sax.SAXParseException: Premature end of file.</p>
  </blockquote>
  
  <p>Any suggestions?</p>