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

I have posted in my other thread as well. I have finally built a module to handle XML data feed.

Feel free to use/modify it to suit your need. See wiki for more details. Wiki:// ANO XML Parser

       
Bruce2005's avatar
Bruce2005
536 posts
17 years ago
Bruce2005's avatar Bruce2005

Unable to load the following language file: /lang.ano_xml_parser.php

I have waited long time for xml_walk as I do a lot of xml stuff. Trying the above, the zip file is missing the lang file. Looking forward to trying it, I have been using php5 which is awesome, and the original magpie parser which handles anything pretty well, but this as a module looks very good.

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

Fixed. Please re-load the new zip file.

Btw, anyone knows if there is a way to delete the old zip file in Wiki area?

       
Bruce2005's avatar
Bruce2005
536 posts
17 years ago
Bruce2005's avatar Bruce2005

Wow that was fast, installed ok, looks good. Can it do: media:content url? Note to self: try it then ask: Media: {item_media:content_url}

Works!!!! This is beyond awesome that it does media namespace and enclosure tags.

Is there a limit tag?

Thank you!

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

Sorry, no limit or the ususal EE parameters. If you dig PHP, you should have no problem to modify the file to suit your needs.

       
camwest's avatar
camwest
14 posts
17 years ago
camwest's avatar camwest

Hey, any way in your plugin to grab the first item out of a match so for example I go entry_link_href and there are multiple tags like this:

<entry>

<link href=”“> <link href=”“> <link href=”“>

</entry>

how would I grab the first? right now it only grabs the last.

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

From my on-line document:

Overview - This plugin will parse a valid remote XML-based file and return entries as EE variables to be used in your EE template. - This parser will also work as a RSS reader but channel information will be omitted. - XML data are cached in database to improve performance. - Cached data can be monitored in Module Control panel. - You should use the W3C tool (XML Validator) to validate your XML data feed. - Within each child node, no identical element name is allowed at the same level. - PHP CURL (Client URL library) is required on web server to run this module. - This light-weight parser may not work with very large or deep-nested XML files. - Feel free to customize this module to suit your needs. I only implement it in the most basic way to deal with my XML project on hand.


So the answer is a unfortunately no. You can add logics in the area where the tag names are constructed by appending like _1, _2 for duplicated names. That should do the trick but do need some development works.

       
camwest's avatar
camwest
14 posts
17 years ago
camwest's avatar camwest

Ugh that really blows. The plugin does exactly what i want but I have no control over the XML file. I’m using Gdata as a service and all of their xml files have identical element names at the same level.

Can anyone suggest a different plugin?

       
Bruce2005's avatar
Bruce2005
536 posts
17 years ago
Bruce2005's avatar Bruce2005

Two options, not plugins but work, the Sofee XML Parser

or if you have php5 use SimpleXML, both will do as wanted/

       
camwest's avatar
camwest
14 posts
17 years ago
camwest's avatar camwest

Thanks Bruce, i’ll look into it.

       
Bruce2005's avatar
Bruce2005
536 posts
17 years ago
Bruce2005's avatar Bruce2005

Article at Zend that is good on simplexml and parsing

how would I grab the first? right now it only grabs the last.

example there to get specific items:

// access each <sin> 
echo $xml->sin[0] . "\n";  <- first item
echo $xml->sin[1] . "\n"; 
echo $xml->sin[2] . "\n"; 
echo $xml->sin[3] . "\n"; 
echo $xml->sin[4] . "\n"; 
echo $xml->sin[5] . "\n";
       
Andy Harris's avatar
Andy Harris
958 posts
16 years ago
Andy Harris's avatar Andy Harris

Hey Arnold. Do you (or anyone!) know why I get this:

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/deadfrog/public_html/system/modules/ano_xml_parser/mod.ano_xml_parser.php on line 101

       
arnoldc's avatar
arnoldc
122 posts
16 years ago
arnoldc's avatar arnoldc
Hey Arnold. Do you (or anyone!) know why I get this: Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/deadfrog/public_html/system/modules/ano_xml_parser/mod.ano_xml_parser.php on line 101

Hi Andy,

This is a harmless warning. I don’t recall the exact cause now. I experienced the same issue with a site hosting on EngineHosting. I just muted the error and everything works fine.

@curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
       
Andy Harris's avatar
Andy Harris
958 posts
16 years ago
Andy Harris's avatar Andy Harris

Ahh, so I’m only seeing that because I’m logged in as SuperAdmin I presume. That’s fine by me!

Thanks for the reply.

       
bg2k's avatar
bg2k
1 posts
16 years ago
bg2k's avatar bg2k

Hi,

Thanks for posting this module, it does exactly what I need. The only small issue I have is that if the XML file is not found or the XML is invalid PHP error messages are echo’d to the page, breaking the layout.

Is there an easy way to alter the module to have it fail silently? Sorry I’m not very familiar with PHP.

It would be perfect if it would fail silently or just output a simple error to the page.

Thanks again.

       
1 2 3 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.