Hey, currently i'm working on the migration of an XML based source. The whole migration works fine, if the XML file is stored locally. But if I have to fetch the XML file from an external url, the migration doesn't work. I'm using the data-fetcher plugin and url looks like this:
https://username:password@xyz.de/migration.xml. Eventually it doesn't work because of the protocoll?

The code of the migration:

source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: xml
  urls:
    - https://username:password@xyz.de/migration.xml
  item_selector: '/dataroot/migration'
  key: default

Regards,

Max

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maxpg created an issue. See original summary.

srjosh’s picture

I have recently found that the http and file parsers handle the item_selector differently. In the example above, try using just 'migration' as the item_selector.

ahebrank’s picture

The xml parser plugin ignores the fetcher plugin; it directly reads the URL with PHP's XMLReader. If you can use it, the simple_xml parser does use the specified fetcher.

I had a similar problem, needing both the xml parser and fetch authentication, so patched to make the parser use the specified fetcher (fetcher saves to a tmp file, XMLReader reads from the temporary:// uri).

ahebrank’s picture

Reroll to fix deprecated function.

ahebrank’s picture

Version: 8.x-4.0-beta1 » 8.x-5.x-dev
ahebrank’s picture

Oops, not a static function.

ahebrank’s picture

OK, this one actually applies. Thanks @evac9.

pfrenssen’s picture

Title: Problems with the data-fetcher plugin concerning a XML based external source. » XML parser ignores the data-fetcher plugin
Category: Support request » Feature request
Status: Active » Needs work

This works great, thanks for the patch. Setting to needs work to inject the FileSystem service rather than accessing it through the `\Drupal::service()` facade.

pfrenssen’s picture

Version: 8.x-5.x-dev » 6.0.x-dev
Status: Needs work » Needs review
FileSize
3.27 KB

Injected the FileSystem service and rerolled for 6.0.x.

trackleft2’s picture

Status: Needs review » Reviewed & tested by the community

Patch resolves the issue