Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#9 | 2902819-9.patch | 3.27 KB | pfrenssen |
Comments
Comment #2
srjoshI 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.
Comment #3
ahebrank CreditAttribution: ahebrank commentedThe 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).
Comment #4
ahebrank CreditAttribution: ahebrank commentedReroll to fix deprecated function.
Comment #5
ahebrank CreditAttribution: ahebrank commentedComment #6
ahebrank CreditAttribution: ahebrank commentedOops, not a static function.
Comment #7
ahebrank CreditAttribution: ahebrank commentedOK, this one actually applies. Thanks @evac9.
Comment #8
pfrenssenThis works great, thanks for the patch. Setting to needs work to inject the FileSystem service rather than accessing it through the `\Drupal::service()` facade.
Comment #9
pfrenssenInjected the FileSystem service and rerolled for 6.0.x.
Comment #10
trackleft2 CreditAttribution: trackleft2 commentedPatch resolves the issue