Unfortunately for us, you haven't posted an XPath expression. What you posted was some Java code which produces an XPath expression. It would be much easier if you posted the actual XPath expression which you say you tested. (Presumably that site just tests expressions for well-formedness.)
Here's what I think the problem is: that DTD referenced at the beginning applies a default attribute to your <svg> root element. And that attribute looks like this:
So, that declares a default namespace for the document and all of the elements are in that namespace. Your XPath expression is looking for <text> elements which are in no namespace but there aren't any. All of the <text> elements are in the "http://www.w3.org/2000/svg" namespace.
You can fix this by searching for <text> elements which are in the "http://www.w3.org/2000/svg" namespace. Attach a namespace binding to that XPath expression which has prefix "svg" and namespace URI "http://www.w3.org/2000/svg". (I don't know how to do that but there must be a way.) Then change the XPath expression to search for <svg:text> elements.
Your document uses the default namespace. But you need a prefix for the namespace so that XPath knows to search for elements with a particular namespace URI. So my quick look at the XPathAPI documentation (that is the Xalan XPathAPI, right?) suggests you're going to have to provide a PrefixResolver to the API because of that.
And there's only one method in there which takes a PrefixResolver as a parameter, so I guess you will have to make do with that.