# This migration demonstrates importing from a monolithic XML file.
dependencies:
enforced:
module:
- complimentmigration
id: compliment_xml_to_node
label: XML feed of nodes from compliment
migration_group: compliment
migration_tags:
- advanced xml import
source:
# We use the XML data parser plugin.
plugin: url
data_fetcher_plugin: http
data_parser_plugin: xml
# Normally, this is one or more fully-qualified URLs or file paths. Because
# we can't hardcode your local URL, we provide a relative path here which
# hook_install() will rewrite to a full URL for the current site.
urls: private://FINRAManual08-08-18.xml
# - /migrate_example_advanced_position?_format=xml
# Visit the URL above (relative to your site root) and look at it. You can see
# that <response> is the outer element, and each item we want to import is a
# <position> element. The item_xpath value is the xpath to use to query the
# desired elements.
item_selector: '/quickpipe/section/section/section'
# Under 'fields', we list the data items to be imported. The first level keys
# are the source field names we want to populate (the names to be used as
# sources in the process configuration below). For each field we're importing,
# we provide a label (optional - this is for display in migration tools) and
# an xpath for retrieving that value. It's important to note that this xpath
# is relative to the elements retrieved by item_xpath.
fields:
-
name: versionid
label: 'Version Id'
selector: 'version[1]/@recordId'
-
name: title
label: 'Title'
selector: 'version[1]/title'
-
name: content
lable: 'Content'
selector: 'version[1]/content'
# Under 'ids', we identify source fields populated above which will uniquely
# identify each imported item. The 'type' makes sure the migration map table
# uses the proper schema type for stored the IDs.
ids:
versionid:
type: integer
destination:
plugin: entity:node
process:
# Hardcode the destination node type (bundle) as 'migrate_example_beer'.
type:
plugin: default_value
default_value: article
title:
plugin: stripouthtml
source: title
uid:
plugin: default_value
default_value: 1
sticky:
plugin: default_value
default_value: 0
body: content
migration_dependencies: {}