Here is a straightforward port to drupal7. Therefore i made a little fix in views itself.

Comments

mugunth’s picture

I tried the patch on views3 version: 7.x-3.0-beta3.
But while creating a new view (after selecting XML option) i get following errors:

Error message

Notice: Undefined index: field in views_plugin_display->get_plugin() (line 709 of C:\xampp\htdocs\drupal7\sites\all\modules\views\plugins\views_plugin_display.inc).
Notice: Undefined property: xml_views_handler_field::$table_alias in xml_views_handler_field->query() (line 38 of C:\xampp\htdocs\drupal7\sites\all\modules\xml_views\handlers\xml_views_handler_field.inc).
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "" in xml_views_plugin_query_xml->execute() (line 55 of C:\xampp\htdocs\drupal7\sites\all\modules\xml_views\xml_views_plugin_query_xml.inc).
Notice: Undefined index: field in view->init_query() (line 573 of C:\xampp\htdocs\drupal7\sites\all\modules\views\includes\view.inc).

Fatal error: Call to a member function xpath() on a non-object in C:\xampp\htdocs\drupal7\sites\all\modules\xml_views\xml_views_plugin_query_xml.inc on line 56

joostvdl’s picture

I would very much like to see a D7 prot of this module.

kika’s picture

subscribe

sheldon rampton’s picture

Yeah, upgrade this thing to D7. It's way cool and opens up a lot of potential power for Drupal as an XML database.

andypost’s picture

maybe better to join forces with #981810: views_datasource module Drupal 7 port

Rushwind’s picture

Views Datasource, like most projects that involve Drupal and external data sources, is about taking Drupal content and exporting it to another system.

XML Views, on the other hand, is about taking external data (in the form of an XML file) and displaying it within Drupal.

The above patch addresses a function-naming inconsistency between D6 and D7. However, even with the patch installed, I have not found a place to create a View in Drupal that is of the "XML" type.

I have done some small amount of module-writing and editing, but there is something different between the way that D6's Views configuration page is laid out and the D7 layout that is preventing this from working.

If anyone has done D6 to D7 module porting, some insight into this would be helpful.

vaidik’s picture

Subscribing and eagerly waiting for the D7 release.

dawehner’s picture

StatusFileSize
new3.33 KB

Okay here is a new version, which fixes all issues at least for me.

IMPORTANT: Some of the fixes required to fix views itself. Please use the DEV release of tomorrow or git.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Great, waiting for 7.x-1.0rc1

sirtet’s picture

Would also love to see something like this for D7...

As for joining forces, the next similar module to this, as far as i see is
http://drupal.org/project/yql_views_query
which also has only requests for a D7 version.

i searched quite a bit, but did not find any other modules that bring external data sources into views.
only browsed through the first 300 or so of the over 2000 results for modules with keyword "views":
http://drupal.org/search/apachesolr_multisitesearch/views?filters=ss_met...

twistor’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new20.12 KB

The patch above those an error about views_process_dependency(). It's an old bug, I went to fix it and wound up somewhere else.

  • Declare different field types based on the expected value. text, number, date, html, etc.
  • Provide appropriate handlers (sort, filter, etc) for those.
  • In sorts and filters, rather than declaring a new xpath selector, use an existing field. The current behavior took me a while to wrap my head around, and I think this makes more sense.
  • Namespaces. They need to be declared before they are usable in xpath. Also, the default namespace isn't accessible, so we need to map that to something else. Right now, it's "default" with the option to rename it. For an example, try parsing an Atom document with the current version.
  • I added back a whole bunch more filters (think contains, starts-with, etc) which require function support. SimpleXML doesn't offer that, so it will be needed to be ported to the DOM.
  • I ported it to use the DOM. This offers a lot of benefits, such as, function support, cdata, typed results.
  • The way that it handles multiple values should probably be revised.

There are lots of hanging bits, but it's operating quite nicely for simple tasks. I want to post this early as I'm curious to see the reception.

itangalo’s picture

I get the following errors when trying to apply this patch:

error: handlers/xml_views_handler_field_numeric.inc: No such file or directory
error: handlers/xml_views_handler_filter_numeric.inc: No such file or directory

This was when trying to apply the patch to the master branch (which was the only branch available on this project). Is there another patch I should apply first, or am I missing something else?

EDIT: The patch applies well when creating these files with empty content. :-)

dawehner’s picture

You know porting a module which rewriting everything is not the way to get something done... Make small chunks which are easy to fix is the root to go.

itangalo’s picture

Been playing around with the (patched) D7 version for a little while now, and I would definitely say it works well and could be a new branch. Just saying.

mitchell’s picture

itangalo’s picture

@mitchell: Awesome! Looking forward to seeing this brought further. (I'm assuming that your intention is that the two modules will merge rather than exist in parallel.)

itangalo’s picture

StatusFileSize
new11.98 KB
new20.08 KB

Patch from #11 attached, now with new file additions included.

I don't know whether this is the way for the module to evolve, but I'm gonna use this as an example of external Views backend on a course I'm doing. In case students want to install and try the module themselves, I'm including a zip of it here.

twistor’s picture

I spoke with Dmitri, and he gave me the project.
From Dmitri,

"Feel free to do any/everything, I have no plans for it."

My initial reaction is to move everything over to the sandbox, and bump it to a full project named "Views XML Backend".

My reasoning is that:

  • XML Views and Views XML both exists. That's no bueno.
  • This project doesn't seem to have much of a user base, as far as I can tell, so it wouldn't be a big ordeal.

Thoughts, concerns?

itangalo’s picture

I like the new name better, but continuing this project would be fine as well. :-)
Rock on!

twistor’s picture

Project: XML Views » Views XML Backend
Version: » 7.x-1.0-alpha1

Moving to views_xml_backend.

twistor’s picture

Status: Needs work » Fixed

I'm going to mark this fixed.

New issues with the d7 branch should be created separately.

Status: Fixed » Closed (fixed)

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