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
15 years ago
arnoldc's avatar arnoldc

I am not really sure what’s the problem as I can’t replicate your issue. I try your second link and it works for me like any other data feed. The only different is that I change your image tag to conform to HTML standard so the images will appear.

May be something to do with encoding. I use English and UTF-8. Or may be there is already an option somewhere in EE to sanitize output data which I forgot. It is hard to keep track when one is working with many different CMSs…. Thanks for bringing up though.

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
15 years ago
ErwinVanLun's avatar ErwinVanLun

About the EE 2.0 request: who could help us to convert your module to 2.0? I’d like to pay for the module as it seems to be very useful.

Are you familiar with comparable modules?

       
ChristinaB's avatar
ChristinaB
4 posts
15 years ago
ChristinaB's avatar ChristinaB

Could someone please assist me with the following code?

{exp:ano_xml_parser:fetch source="http://www.obi.org/hr/jobs.xml" refresh="0" parent_tag="loc" child_tag="element" limit="10"}
    ID:{element_name}

{/exp:ano_xml_parser:fetch}

I am not getting any results. It is as though the file is not being acknowledged at all. Any help would be super! Thank you so much!

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
15 years ago
ErwinVanLun's avatar ErwinVanLun

We’re actually working on the EE 2.0 implementation of this module, so we’ve some experience. Personally, I’m a user of this module. Hopefully my answers still help.

{element_name} is not in your XML definition isn’t it? Isn’t that necessary?

Your XML tree seems to quite nested. I believe that this parser doesn’t support deeply nested XML trees.

       
ChristinaB's avatar
ChristinaB
4 posts
15 years ago
ChristinaB's avatar ChristinaB

Hi, thanks for your response.

Please look at the parent tag, ‘loc’, in the code:

{exp:ano_xml_parser:fetch source="http://www.obi.org/hr/jobs.xml" refresh="0" parent_tag="loc" child_tag="element" limit="10"}

The XML I am trying to get is for the ‘loc’ node, not the job and there is an element_name in there.

<loc>
<element>
<name>Oklahoma City</name>
<url>okc</url>
</element>
</loc>

Following the post #21 example, it is necessary to precede the node with the child tag.

I fail to see how the XML is deeply nested; it goes no more levels than that of the example posted in post #21.
humanresources-loc-element-name/url humanresources-listings-job-id/profilepreference/qualifications, etc

Any additional information you could provide would be great. Thank you!

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
15 years ago
ErwinVanLun's avatar ErwinVanLun

mmm, I’m afraid this is were my (current) knowledge ends. But as we’re working on this module, I can imagine I get more insights in a few days from now.

       
ChristinaB's avatar
ChristinaB
4 posts
15 years ago
ChristinaB's avatar ChristinaB

Thanks for your response Erwin! The problem seems to be with the configuration on server. When I move the file onto a different site, it works as expected.

Would anyone happen to know why the XML wouldn’t be recognized? NOTE: I have an xml feed going into a flash banner rotator that works fine.

       
Djive's avatar
Djive
97 posts
15 years ago
Djive's avatar Djive

I would like to thank everyone in advance for any assistance with this problem. If it comes to this being too big of a problem to solve easily or if it needs a different aproach and a rewrite, we are willing to compensate anyone for their work!

We have a tv schedule that is supposed to show 12 channels on 1 page for a certain day. When we put code for 1 or 2 channels in an empty page, it works and the schedule shows but as we add code for more channels it doesnt show them. Code that we are using for 2 channels is this:

<?php
global $LOC;
$future_time_0={current_time}-86400;
$future_time_1={current_time};
$future_time_2={current_time}+86400;
$future_time_3={current_time}+172800;
$future_time_4={current_time}+259200;
$future_time_5={current_time}+345600;
$future_time_6={current_time}+432000;

$expiration_0 = $LOC->decode_date('%j.%n.%Y', $future_time_0);
$expiration_1 = $LOC->decode_date('%j.%n.%Y', $future_time_1);
$expiration_2 = $LOC->decode_date('%j.%n.%Y', $future_time_2);
$expiration_3 = $LOC->decode_date('%j.%n.%Y', $future_time_3);
$expiration_4 = $LOC->decode_date('%j.%n.%Y', $future_time_4);
$expiration_5 = $LOC->decode_date('%j.%n.%Y', $future_time_5);
$expiration_6 = $LOC->decode_date('%j.%n.%Y', $future_time_6);
$expiration_0d = $LOC->decode_date('%l', $future_time_0);
$expiration_1d = $LOC->decode_date('%l', $future_time_1);
$expiration_2d = $LOC->decode_date('%l', $future_time_2);
$expiration_3d = $LOC->decode_date('%l', $future_time_3);
$expiration_4d = $LOC->decode_date('%l', $future_time_4);
$expiration_5d = $LOC->decode_date('%l', $future_time_5);
$expiration_6d = $LOC->decode_date('%l', $future_time_6);
?> 

{exp:ano_xml_parser:fetch source='http://mojtv.hr/xmltv/service.ashx?kanal_id=1&date;={if segment_2 =="<?php echo $expiration_0d; ?>"}<?php echo $expiration_0; ?>{/if}{if segment_2 =="<?php echo $expiration_1d; ?>"}<?php echo $expiration_1; ?>{/if}{if segment_2 =="<?php echo $expiration_2d; ?>"}<?php echo $expiration_2; ?>{/if}{if segment_2 =="<?php echo $expiration_3d; ?>"}<?php echo $expiration_3; ?>{/if}{if segment_2 =="<?php echo $expiration_4d; ?>"}<?php echo $expiration_4; ?>{/if}{if segment_2 =="<?php echo $expiration_5d; ?>"}<?php echo $expiration_5; ?>{/if}{if segment_2 =="<?php echo $expiration_6d; ?>"}<?php echo $expiration_6; ?>{/if}' parent_tag='tv' child_tag='programme'}
{exp:trimmer left="8" right="10"}{programme_start}{/exp:trimmer}:{exp:trimmer left="10" right="8"}{programme_start}{/exp:trimmer}

{if programme_category !=""}{programme_category}
{/if}
{if programme_url !=""}<a href="http://{programme_url}" title="{programme_title}" target="_blank" rel="noopener">{/if}<b>{programme_title}</b>{if programme_url !=""}</a>{/if}

{if programme_desc !=""}{programme_desc}{/if}
{/exp:ano_xml_parser:fetch}

{exp:ano_xml_parser:fetch source='http://mojtv.hr/xmltv/service.ashx?kanal_id=2&date;={if segment_2 =="<?php echo $expiration_0d; ?>"}<?php echo $expiration_0; ?>{/if}{if segment_2 =="<?php echo $expiration_1d; ?>"}<?php echo $expiration_1; ?>{/if}{if segment_2 =="<?php echo $expiration_2d; ?>"}<?php echo $expiration_2; ?>{/if}{if segment_2 =="<?php echo $expiration_3d; ?>"}<?php echo $expiration_3; ?>{/if}{if segment_2 =="<?php echo $expiration_4d; ?>"}<?php echo $expiration_4; ?>{/if}{if segment_2 =="<?php echo $expiration_5d; ?>"}<?php echo $expiration_5; ?>{/if}{if segment_2 =="<?php echo $expiration_6d; ?>"}<?php echo $expiration_6; ?>{/if}' parent_tag='tv' child_tag='programme'}
{exp:trimmer left="8" right="10"}{programme_start}{/exp:trimmer}:{exp:trimmer left="10" right="8"}{programme_start}{/exp:trimmer}

{if programme_category !=""}{programme_category}
{/if}
{if programme_url !=""}<a href="http://{programme_url}" title="{programme_title}" target="_blank" rel="noopener">{/if}<b>{programme_title}</b>{if programme_url !=""}</a>{/if}

{if programme_desc !=""}{programme_desc}{/if}
{/exp:ano_xml_parser:fetch}

Now, to add more channels we just copy same code and change the “kanal_id” variable.

PHP in template has been allowed and PHP Parsing Stage set to Input.

The only thing that needs to change from channel to channel is “kanal_id” and “date” variable.

“kanal_id” we change manually and “date” variable needs to automaticaly calculate what day it is and based on conditionals inside that variable and write the tv schedule into a correct template.

“segment_2” are names of templates. They are called Monday, Tuesday… Names for days of the week as written in language file, here called with ‘%l’ variable.

Once again, thanks to everyone for any assistance you can offer.

Djive

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

Hi Djive,

I have PM you but also post it for the benefits of others to share their views.

I took your codes and simplify a bit so it works for me when I add two more channels for a toal of 4 channels.

I would suggest you to do the following: - add one channel at a time, as the system will trip by showing a blank page as soon as you introduce any kind of syntax error. You have some funky conditional statements and it is easy to forget a quotation here or there.

  • try to compare my codes to yours. If mine works, yours should too. Again, it is likely a sytnax error somewhere in your codes.

  • examine the cache links in the Module section to get a hint if the correct links are being parsed.

  • try each individual channel code to ensure it works first before adding all of them on a single page. May be one of chanenl’s xml feed is broken.

Cheers, Arnold

<?php
global $LOC;

$future_time_0={current_time}-86400;
$future_time_1={current_time};
$future_time_2={current_time}+86400;
$future_time_3={current_time}+172800;
$future_time_4={current_time}+259200;
$future_time_5={current_time}+345600;
$future_time_6={current_time}+432000;

$expiration_0 = $LOC->decode_date('%j.%n.%Y', $future_time_0);
$expiration_1 = $LOC->decode_date('%j.%n.%Y', $future_time_1);
$expiration_2 = $LOC->decode_date('%j.%n.%Y', $future_time_2);
$expiration_3 = $LOC->decode_date('%j.%n.%Y', $future_time_3);
$expiration_4 = $LOC->decode_date('%j.%n.%Y', $future_time_4);
$expiration_5 = $LOC->decode_date('%j.%n.%Y', $future_time_5);
$expiration_6 = $LOC->decode_date('%j.%n.%Y', $future_time_6);
$expiration_0d = $LOC->decode_date('%l', $future_time_0);
$expiration_1d = $LOC->decode_date('%l', $future_time_1);
$expiration_2d = $LOC->decode_date('%l', $future_time_2);
$expiration_3d = $LOC->decode_date('%l', $future_time_3);
$expiration_4d = $LOC->decode_date('%l', $future_time_4);
$expiration_5d = $LOC->decode_date('%l', $future_time_5);
$expiration_6d = $LOC->decode_date('%l', $future_time_6);

echo "Expiration_0=".$expiration_0."<br>";

?> 

{exp:ano_xml_parser:fetch source='http://mojtv.hr/xmltv/service.ashx?kanal_id=1&date;=<?php echo $expiration_0; ?>' parent_tag='tv' child_tag='programme'}
{programme_start}:{programme_start}

{if programme_category !=""}{programme_category}
{/if}
{if programme_url !=""}<a href="http://{programme_url}" title="{programme_title}" target="_blank" rel="noopener">{/if}<b>{programme_title}</b>{if programme_url !=""}</a>{/if}

{if programme_desc !=""}{programme_desc}{/if}
{/exp:ano_xml_parser:fetch}
<hr>
{exp:ano_xml_parser:fetch source='http://mojtv.hr/xmltv/service.ashx?kanal_id=2&date;=<?php echo $expiration_0; ?>' parent_tag='tv' child_tag='programme'}
{programme_start}:{programme_start}

{if programme_category !=""}{programme_category}
{/if}
{if programme_url !=""}<a href="http://{programme_url}" title="{programme_title}" target="_blank" rel="noopener">{/if}<b>{programme_title}</b>{if programme_url !=""}</a>{/if}

{if programme_desc !=""}{programme_desc}{/if}
{/exp:ano_xml_parser:fetch}
<hr>
{exp:ano_xml_parser:fetch source='http://mojtv.hr/xmltv/service.ashx?kanal_id=3&date;=<?php echo $expiration_0; ?>' parent_tag='tv' child_tag='programme'}
{programme_start}:{programme_start}

{if programme_category !=""}{programme_category}
{/if}
{if programme_url !=""}<a href="http://{programme_url}" title="{programme_title}" target="_blank" rel="noopener">{/if}<b>{programme_title}</b>{if programme_url !=""}</a>{/if}

{if programme_desc !=""}{programme_desc}{/if}
{/exp:ano_xml_parser:fetch}
<hr>
{exp:ano_xml_parser:fetch source='http://mojtv.hr/xmltv/service.ashx?kanal_id=4&date;=<?php echo $expiration_0; ?>' parent_tag='tv' child_tag='programme'}
{programme_start}:{programme_start}

{if programme_category !=""}{programme_category}
{/if}
{if programme_url !=""}<a href="http://{programme_url}" title="{programme_title}" target="_blank" rel="noopener">{/if}<b>{programme_title}</b>{if programme_url !=""}</a>{/if}

{if programme_desc !=""}{programme_desc}{/if}
{/exp:ano_xml_parser:fetch}
       
arnoldc's avatar
arnoldc
122 posts
15 years ago
arnoldc's avatar arnoldc

As reported by another user, there seems to be a glitch using a conditional on a variable but is not used in display.

e.g. The user wants to do a conditional check on “character_rank” but not displaying it in the content.

=========

It works fine if I try to display all childnodes at once but if I put this in my template file it doesn’t work.

{exp:ano_xml_parser:fetch source="http://armory.wow-europe.com/guild-info.xml?r=Azshara&gn=Enîgma&rhtml=n" refresh="0" parent_tag="members" child_tag="character"}
    {if character_rank < 3}
        {character_name}
    {/if}
{/exp:ano_xml_parser:fetch}

I only get the correct results if I put “{character_rank}” to the output but I only want the characters name.

============

The current work around:

exp:ano_xml_parser:fetch source="http://armory.wow-europe.com/guild-info.xml?r=Azshara&gn=Enîgma&rhtml=n" refresh="0" parent_tag="members" child_tag="character"}
    {if character_rank < 3}
        {character_name}<span>{character_rank}</span><br>
    {/if}
{/exp:ano_xml_parser:fetch}

UPDATE: Reason for this behavior is the the parser only builds the attributes that are actually used for display. The parser is not aware of attributes used by conditions. By embedding a hidden attribute in content, it solves the issue on hand.

       
Djive's avatar
Djive
97 posts
15 years ago
Djive's avatar Djive

@arnoldc

Thank you very much for your fast reply.

It helped us resolve the issue we had.

Once again, thnx for a great module!

Djive

       
Blue Coast Web's avatar
Blue Coast Web
32 posts
15 years ago
Blue Coast Web's avatar Blue Coast Web

First off, thanks for making this module. I have two questions

1) I have an xml feed that updates daily. Is it possible to have EE take this daily feed and make a static entry out of it? I would like my users to access this as an archive.

2) I’m having issues getting my xml feed to even show up. Here’s the link to my feed

and here’s what I have in my template:

{exp:ano_xml_parser:fetch source='http://www.avantlink.com/api.php?module=DotdFeed&affiliate_id=24375&merchant_id=10063&website_id=30415&custom;_tracking_code=&output=rss&layout_id=10533' refresh='0' parent_tag='channel' child_tag='description'}
{description}
{/exp:ano_xml_parser:fetch}

I tried your example template code on the wiki and it works great, but not the code above.

Thanks!

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

You specify the wrong the child element. This is a RSS feed so you should put “item” as your child tag and access the subsequent properties with format like this {item_xxxxxx}.

See the working codes below:

{exp:ano_xml_parser:fetch source='http://www.avantlink.com/api.php?module=DotdFeed&affiliate_id=24375&merchant_id=10063&website_id=30415&custom;_tracking_code=&output=rss&layout_id=10533' refresh='0' parent_tag='channel' child_tag='item'}
{item_description}
{/exp:ano_xml_parser:fetch}

*EDIT Forget to mention, you can set the refresh=”1440” if you want to cache the link for a day. (60 minutes x 24 = 1440).

       
Blue Coast Web's avatar
Blue Coast Web
32 posts
15 years ago
Blue Coast Web's avatar Blue Coast Web

Hi arnoldc, This may be a little out of scope for the plugin, but I wanted to know if you have any advice on how to do this.

I have a single page website (with archives), that displays one main product from an rss feed that updates daily. My goal is to make that homepage a single “static” entry so that users can make comments and access the archive of older products. So basically, I need to automatically make an entry on a daily basis. It needs to be an entry because I would like to also automatically send out a tweet whenever there is a new entry.

Any advise would be great!

       
Art Practical's avatar
Art Practical
13 posts
15 years ago
Art Practical's avatar Art Practical

Hi Arnold,

We use your XML parser on our site to display content from a partner site. So far everything has worked great! Everything except for one thing: when the site that we are parsing content from is down the pages that use the ANO XML Parser on our site don’t load at all. Since one of these pages is our home page our site essentially goes offline during that time.

Is there any kind of response timeouts functionality built in the parser or any other way that would allow us to make sure our pages load when the response from the xml feed is not coming in time or not coming at all??

Thank you.

AP team

       
First 5 6 7 8

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.