I have searched and read all documentation related to feeds module and am still not able find solution to my requirement.

I am trying to use Feeds module to fetch an XML file, parse it and read it as an object. All of this needs to be done programatically in a custom module without having to use the "setup" (admin/build/feeds) but by executing code present in feeds module. Perhaps by setting up $source and calling fetch().

Consider the below pseudo code -

.
.
$url = <some xml file URL>;
// do any preparation using $url if required ?
$fetched_xml_object = < do magic using feed module to read XML file as an object ? >
.
// use $fetched_xml_object for custom functionality

There needs to be no redirects, node creation, mapping et al.

Does anybody know how this can be done?

If I can figure this out I would be glad to add a handbook page describing my my requirement (in detail), the documentation I referred and final solution implemented.

Thanks in advance.

Comments

alex_b’s picture

Status: Active » Fixed

Feeds comes with two RSS/Atom XML parser integration, for details on them, look at plugins/FeedsSimplePieParser.inc and plugins/FeedsSyndicationParser.inc.

You may be looking for sth like: #631104: Extensible XML parser (mapping more sources)

sumeet.pareek’s picture

Thanks for the reply. Since my use case was rather simple, I ended up using file_get_contents() and simplexml_load_string().

Feeds module is indeed quite amazing and I intend to use it more often in future.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.