Problem/Motivation

I have complex data structures in an XML export that I need to run through a custom process plugin which will upload files etc then save entities and return those entity ids as part of an entity reference field. In my migrate_plus migration config I have the field set to an attachments field which looks something like this:

<attachments>
			<attachment1>
				<title><![CDATA[Document 1]]></title>
				<url><![CDATA[example.com/document1.pdf]]></url>
			</attachment1>
			<attachment2>
				<title><![CDATA[Document 2]]></title>
				<url><![CDATA[example.com/document2.pdf]]></url>
			</attachment2>
</attachments>

But my process plugin receives an empty string because the Xml parser casts the field values as strings.

Proposed resolution

Check at a field level if we have complex data and cast appropriately.

CommentFileSizeAuthor
#2 2792765-allow-xml-values-1.patch1.07 KBacbramley
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acbramley created an issue. See original summary.

acbramley’s picture

Status: Active » Needs review
FileSize
1.07 KB

Something like this could work. Maybe there's already a way to do this, I'm not too sure.

Grayside’s picture

Grayside’s picture

  • mikeryan committed bec3f3e on 8.x-2.x authored by acbramley
    Issue #2792765 by acbramley: Allow XML elements to pass through as field...
mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks!

  • mikeryan committed bec3f3e on 8.x-3.x authored by acbramley
    Issue #2792765 by acbramley: Allow XML elements to pass through as field...

Status: Fixed » Closed (fixed)

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