Java Xpath query failing on compile

ooiiidddffff

New Member
I have the following XML document:\[code\]<application xmlns="http://www.example.com/schemas/app-config/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/schemas/app-config/1.0 http://www.example.com/schemas/app-config/1.0/app-config-1.0.xsd"> <info name="Dummy Application" runningOn="Dev"/></application>\[/code\]When I run the following code:\[code\]XPathFactory factory = XPathFactory.newInstance();XPath xpath = factory.newXPath();XPathExpression expr = xpath.compile("/application/info@name");\[/code\]I get an \[code\]XPathExpressionException\[/code\] on the \[code\]compile\[/code\] method. The exception's message is simply "\[code\]null\[/code\]". It looks like I'm correctly using XPath to locate the \[code\]name\[/code\] attribute, but I'm wondering if all my XMLNS and XSI declarations are causing problems here? If not then I'm totally clueless and have no idea what's causing this exception.One thing - how can \[code\]compile\[/code\] be failing before I ever associate the \[code\]xpath\[/code\] instance with my actual \[code\]Document\[/code\] object?!?
 
Back
Top