开发者

Xpaths query problem

开发者 https://www.devze.com 2023-04-04 14:49 出处:网络
<?xml version=\'1.0\'?> <sparql开发者_如何学C xmlns=\'http://www.w3.org/2005/sparql-results#\'>
<?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'].

0

精彩评论

暂无评论...
验证码 换一张
取 消