douwei1930
2010-09-22 10:26
浏览 34
已采纳

如何用PHP解析eXist XQuery响应?

I am trying to find an easy way to parse an eXist response with php without installing third party classes.

This is the type of response that I would like to parse :

<exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist">
  <exist:collection name="xData" path="/db/SBXXX/00000000-00000000/sapData" created="2010-07-15T16:12:09.135-05:00">
    <exist:resource name="xDataData1.xml" size="1565" created="1969-12-31T18:00:00.000-06:00" last-modified="2010-09-20T23:42:09.584-05:00"/>
    <exist:resource name="xDataData10.xml" size="805" created="1969-12-31T18:00:00.000-06:00" last-modified="2010-09-21T01:27:09.614-05:00"/>
    <exist:resource name="xDataData11.xml" size="806" created="1969-12-31T18:00:00.000-06:00" last-modified="2010-09-21T01:27:22.005-05:00"/>
    <exist:resource name="xDataData12.xml" size="1565" created="1969-12-31T18:00:00.000-06:00" last-modified="2010-09-21T01:42:15.768-05:00"/>
    <exist:resource name="xDataData13.xml" size="805" created="1969-12-31T18:00:00.000-06:00" last-modified="2010-09-21T01:57:09.749-05:00"/>
  </exist:collection>
</exist:result>

I am trying with the simplexml_load_string php function but I get back an empty SimpleXMLElement object with no errors.

I would like to get out of this response the list of XML files.

Thanks

图片转代码服务由CSDN问答提供 功能建议

我试图找到一种简单的方法来解析 eXist响应</ strong>而不安装 第三方类。</ p>

这是我要解析的响应类型:</ p>

 &lt; exists:result xmlns:exists  =“http://exist.sourceforge.net/NS/exist”&gt; 
&lt; exist:collection name =“xData”path =“/ db / SBXXX / 00000000-00000000 / sapData”created =“2010-07  -15T16:12:09.135-05:00“&gt; 
&lt; exists:resource name =”xDataData1.xml“size =”1565“created =”1969-12-31T18:00:00.000-06:00“last  -modified =“2010-09-20T23:42:09.584-05:00”/&gt; 
&lt; exist:resource name =“xDataData10.xml”size =“805”created =“1969-12-31T18:00  :00.000-06:00“last-modified =”2010-09-21T01:27:09.614-05:00“/&gt; 
&lt; exists:resource name =”xDataData11.xml“size =”806“created =  “1969-12-31T18:00:00.000-06:00”last-modified =“2010-09-21T01:27:22.005-05:00”/&gt; 
&lt; exists:resource name =“xDataData12.xml  “size =”1565“created =”1969-12-31T18:00:00.000-06:  00“last-modified =”2010-09-21T01:42:15.768-05:00“/&gt; 
&lt; exist:resource name =”xDataData13.xml“size =”805“created =”1969-12-  31T18:00:00.000-06:00“last-modified =”2010-09-21T01:57:09.749-05:00“/&gt; 
&lt; / exist:collection&gt; 
&lt; / exists:result&gt; \  n </ code> </ pre> 
 
 

我正在尝试使用 simplexml_load_string </ strong> php函数,但是我找回了一个没有错误的空SimpleXMLElement对象。</ p> \ n

我想退出这个XML文件列表的响应。</ p>

谢谢</ p> </ div>

2条回答 默认 最新

相关推荐 更多相似问题