We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

ANO XML Parser

Development and Programming

arnoldc's avatar
arnoldc
122 posts
16 years ago
arnoldc's avatar arnoldc

Ah, it’s a bug.

It is now fixed in version 1.2.4 in which you can download in the Wiki area.

Thanks for reporting.

       
DIY's avatar
DIY
28 posts
16 years ago
DIY's avatar DIY

When taking date information from a feed, is there a way of limiting it, or formatting it in a different way? At the moment, I have Sat, 23 May 2009 20:00:00 -0700, when really all I’d like is the date, without the time.

Additionally, there’s & in the title tag in the RSS source code, which is ignored entirely when parsed.

       
arnoldc's avatar
arnoldc
122 posts
16 years ago
arnoldc's avatar arnoldc
When taking date information from a feed, is there a way of limiting it, or formatting it in a different way? At the moment, I have Sat, 23 May 2009 20:00:00 -0700, when really all I’d like is the date, without the time. Additionally, there’s & in the title tag in the RSS source code, which is ignored entirely when parsed.

Sorry, the parser just takes the raw data, you may need to resort to Javascript for this purpose.

If you are doing standard RSS feed, perhap Magpie is a better choice. This parser will parse child elements in RSS only.

       
Visibly Better Marketing's avatar
Visibly Better Marketing
93 posts
16 years ago
Visibly Better Marketing's avatar Visibly Better Marketing

I’m trying to use this to parse Jrank search resuts instead of EE’s own search

Here’s the form:

<form action="{path=search/jrank}" method="get">
 <input id="q" name="q" style="display: inline; vertical-align: middle;" type="text" value="" />
 <input name="commit" style="display: inline; vertical-align: middle;" type="submit" value="Search" />
</form>

here’s the results page:

<?php
global $IN, $REGX; 
$query = $IN->GBL('q', 'GET');
$query= $REGX->xss_clean($query);
?>

<h1>Search Results for "<?php if ($query !== FALSE)    {echo $query;} ?>"</h1>
{exp:ano_xml_parser:fetch
source='http://www.jrank.org/api/search/v2.xml?key=c899f339833cd7f594b2eaa5915e903bbae8a0e6&q=<?php echo $query; ?>'
refresh='0' parent_tag='entries' child_tag='entry'}

{entry_title}<br>
<!--{entry_content}
-->
<a href="http://{entry_url}">{entry_url}</a>

{/exp:ano_xml_parser:fetch}

It doesn’t look like I can include PHP within the opening tag in order to pass my search term to Jrank

Any ideas?

       
arnoldc's avatar
arnoldc
122 posts
16 years ago
arnoldc's avatar arnoldc

I just tried the following codes and it works. The key thing is that you have to setup the parsing stage of the template file to be “Input”, not “Output” in the Preferences section.

<?php 
  echo "<h1>W3C Sample XML Test</h1>"; 
  $url = "http://www.w3schools.com/xml/simple.xml";
  echo "URL = ".$url."";
?>

{exp:ano_xml_parser:fetch source='<?php print $url; ?>' refresh="0" parent_tag="breakfast_menu" child_tag="food"}
{if food_name=="apple"}
i love apple very much
{/if}
Food Name; {food_name} with only {food_calories} calories

Price: {food_price}

Description: {food_description}

<hr>
{/exp:ano_xml_parser:fetch}
       
jeremydouglas's avatar
jeremydouglas
292 posts
16 years ago
jeremydouglas's avatar jeremydouglas

Something I found on this.

I’m pulling an xml feed from one EE site to another. On my local MAMP install it worked fine to leave the trailing slash off of the end, on the live server there were no results until I put that trailing forward slash at the end of the URL.

       
arnoldc's avatar
arnoldc
122 posts
16 years ago
arnoldc's avatar arnoldc

That’s strange.

The only explanation I can think of is that somehow you’re using an old cache. Each entry uses the full URL as the record ID. So when you add a slash to the URL, you are essentially creating a new data entry in the system.

       
jeremydouglas's avatar
jeremydouglas
292 posts
16 years ago
jeremydouglas's avatar jeremydouglas

Yes I saw that it created a new entry. Not a big deal. For some reason it worked differently on the two different servers. I didn’t import the database from local to live either, so there shouldn’t have been a cache issue.

       
NKT com's avatar
NKT com
124 posts
about 16 years ago
NKT com's avatar NKT com

Sorry if this is a simple question but how would i display this url…

http://kadampa.smugmug.com/photos/601411301_XYYaj-Ti.jpg[code]

From inside...

[code]<link rel="icon" type="image/jpeg" href="http://kadampa.smugmug.com/photos/601411301_XYYaj-Ti.jpg"/>

Within this feed?

Thanks for this truly awesome plugin!

       
arnoldc's avatar
arnoldc
122 posts
about 16 years ago
arnoldc's avatar arnoldc

I see you want to parse an Atom feed and you want to parse the link tags. The parser can only parse one one type of child at a time, so perhap you can setup another feed to parse the link elements and to extract the icon image.

See codes:

<h1>ATOM Link Test</h1>
{exp:ano_xml_parser:fetch source='http://kadampa.smugmug.com/hack/feed.mg?Type=gallery&Data=9034508_kbZUi&format=atom03&Size=Small&ImageCount=100' refresh="0" parent_tag="feed" child_tag="link" limit="5"}
LINK TYPE={link_type}<br>
LINK REF={link_href}<br>
{if link_type=="image/jpeg"}
<img ><br>
{/if}
<hr>
{/exp:ano_xml_parser:fetch}

*** apparently the forum filters out the image tag so it appears as empty in the code section but you should simply fill it in by setting the src to {link_href}.

       
NKT com's avatar
NKT com
124 posts
about 16 years ago
NKT com's avatar NKT com

That worked! Thanks.

Here is a tougher one. Is there any way to output just the thumbs, medium size and large images in a feed like this?

http://api.smugmug.com/hack/feed.mg?Type=gallery&Data=9034508_kbZUi&format=osrss&ImageCount=100&Sandboxed=1

       
arnoldc's avatar
arnoldc
122 posts
15 years ago
arnoldc's avatar arnoldc

Sure. See the following example code.

<h1>RSS Image Links Test</h1>
{exp:ano_xml_parser:fetch source='http://api.smugmug.com/hack/feed.mg?Type=gallery&Data=9034508_kbZUi&format=osrss&ImageCount=100&Sandboxed=1' refresh="0" parent_tag="channel" child_tag="item" limit="2"}
Item Title={item_title}<br>
Media URL 1={item_media:group_media:content_url}<br>
Media URL 2={item_media:group_media:content_url_2}<br>
Media URL 3={item_media:group_media:content_url_3}<br>
<!--  illustrate use of condition to detect existence of variable  -->
{if item_media:group_media:content_url_4}
Media URL 4={item_media:group_media:content_url_4}<br>
{/if}
{if item_media:group_media:content_url_99}
Media URL 99=THIS LINE SHOULD NOT APPEAR
{/if}
<hr>
{/exp:ano_xml_parser:fetch}
       
osadmin's avatar
osadmin
19 posts
15 years ago
osadmin's avatar osadmin

I’m trying to use this module to show only xml entries that have an attribute set to “Yes” with all other details is this possible? The code I am using is below…

{if news_live=='Yes'}

Title = {news_title} br >
Link = {news_link}
<hr>
{/if}

If not can anyone suggest another extension/module that could do this?

       
arnoldc's avatar
arnoldc
122 posts
15 years ago
arnoldc's avatar arnoldc

kreate, is the code not working for you? It should work.

Anyway, here’s an example that illustrates the use of conditional and it works:

<h1>W3C XML Conditonal Test</h1>

{exp:ano_xml_parser:fetch source='http://www.w3schools.com/xml/simple.xml' refresh="0" parent_tag="breakfast_menu" child_tag="food"}
{if food_name=="Belgian Waffles"}
I LOVE TO EAT {food_name}.  The price is: {food_price}<br>
<hr>
{/if}
{/exp:ano_xml_parser:fetch}
       
osadmin's avatar
osadmin
19 posts
15 years ago
osadmin's avatar osadmin

Thanks, for some reason it has now started working so not sure what the problem was. I am having another issue now though which I do not know the answer to. I want to limit the number of results to 5 results that are set to live. If only 2 out of the first 5 have this setting then it will only display the 2 results and not the first 5 that are set to be live. Is there a way i can achieve this?

       
First 2 3 4 5 6 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.