Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/164.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 需要c+中的算法+;用于通过xpath导航的xml文档_C++_Xpath - Fatal编程技术网

C++ 需要c+中的算法+;用于通过xpath导航的xml文档

C++ 需要c+中的算法+;用于通过xpath导航的xml文档,c++,xpath,C++,Xpath,在下面的XML文档中 <?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <x:Response xmlns

在下面的XML文档中

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<x:Response xmlns:xcr="http:sefgvsefraerdv">
<folder id='82273' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns'http://srdefaredr/folders.xsd'>
<folder id='104018' name='account'/>
<folder id='104019' name='aaaaa'/>
<folder id='82277' name='Desktop' system='desktop'/>
<folder id='82278' name='Trashcan' system='trashcan'/>
<folder id='82279' name='Documents'>
       <folder id='82280' name='Music'/>
       <folder id='82281' name='Pictures'>
            <folder id='82282' name='Nature Album'/>
       </folder>
</folder>
<folder id='82283' name='Public' system='public'/>
<folder id='82284' name='music1'/>
<folder id='82286' name='music'>
     <folder id='105744' name='abba'/>
</folder>
</folder>

</x:Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我将获取文档中的所有文件夹。由此我需要给出
/*/*/*/*/*[5]/*
要获取音乐和图片,请执行以下操作:
/*/*/*/*/*[5]/*/*/*
仅获取Naturealbum

然后一直返回到
/*/*/*/*/*[6]
然后继续

要获取所有ID:

//folder/@id

如果你有记事本+,有一个用于测试xpath的xpath插件。

你亲自输入了吗?因为它有一些语法错误,还缺少名称空间
x
是的,我手工输入了。语法没什么大不了的。只需要用于导航目的的算法:)好的,我只是复制了它来测试我的答案,我必须在它工作之前修复它。通过提供//folder/@id,我只能获得文件夹aaa、文档等。我无法获得音乐的文件夹id,Pictures and Nature album和Abbabasicaly我必须这样做,以防我使用名称空间/*/*/*/*/*/*[local-name()='folder']/@idWell我对它进行了测试,我只能说你的xml必须与我修复后发布的xml不同,或者你正在处理损坏的xml。发布实际有效的xml。如果我给出//@id,工作正常。谢谢,因为文档中只有文件夹id。
//folder/@id