<?xml version='1.0'?>
<sparql开发者_如何学C xmlns='http://www.w3.org/2005/sparql-results#'>
<head>
<variable name='r'/>
</head>
<results>
<result>
<binding name='r'>
<uri>http://127.0.0.1/rdfs/CRM.rdfs#E1.CRM_Entity</uri>
</binding>
</result>
</results>
</sparql>
i have this xml and i trying to parse the values using xpath and exist db (in java). but the only one query which give me feedback is " //* ". I want to take the value of uri but i cant't. The //uri returns me null. I use eclipse tool about xpaths. It generate me the path but when i try that path in the same tools returns me again null. Any idea? thanks in advance...
Your XML has default namespace: http://www.w3.org/2005/sparql-results#. So you need to define it in your XML/XPath engine, define prefix (e.g. pr
) and use it in XPath: //pr:uri
. Or you can use this XPath: //*[local-name() = 'uri']
.
精彩评论