Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to handle multiple xpath at once (based on feed structure) or create my own feeds with the same structure
    primarykey
    data
    text
    <p>the code below is tested and working, it prints the contents of a feed that has this structure.</p> <pre><code>&lt;rss&gt; &lt;channel&gt; &lt;item&gt; &lt;pubDate/&gt; &lt;title/&gt; &lt;description/&gt; &lt;link/&gt; &lt;author/&gt; &lt;/item&gt; &lt;/channel&gt; &lt;/rss&gt; </code></pre> <p>What I didn't manage to succesfully do is to print feeds that follow this structure below (the difference is on <code>&lt;feed&gt;&lt;entry&gt;&lt;published&gt;</code> ) even though I changed the xpath to <code>/feed//entry</code>. you can see the structure on the page source.</p> <pre><code>&lt;feed&gt; &lt;entry&gt; &lt;published/&gt; &lt;title/&gt; &lt;description/&gt; &lt;link/&gt; &lt;author/&gt; &lt;/entry&gt; &lt;/feed&gt; </code></pre> <p>I have to say that the code sorts all <code>item</code> based on its <code>pubDate</code>. In the second structure feed I guess it should sort all <code>entry</code> based on its <code>published</code>.</p> <p>I probably make a mistake on the xPath I can't find. However, if at the end of this I manage to print that feed right, how can I modify the code to handle different structures all at once ?</p> <p>Is there any service that allow me to create and host my own feeds based on those feeds, so I will have the same structure to all? I hope I made my self clear... Thank you.</p> <pre><code>&lt;?php $feeds = array(); // Get all feed entries $entries = array(); foreach ($feeds as $feed) { $xml = simplexml_load_file($feed); $entries = array_merge($entries, $xml-&gt;xpath('')); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload