I have XML like below -

<Educations>
  <Education>
    <DateAwarded>1982-01-01T00:00:00</DateAwarded>
    <DegreeAwarded>SM</DegreeAwarded>
    <Institution>University of Chicago</Institution>
  </Education>
  <Education>
    <DateAwarded>1975-01-01T00:00:00</DateAwarded>
    <DegreeAwarded>MD</DegreeAwarded>
    <Institution>Harvard University</Institution>
  </Education>
  <Education>
    <DateAwarded>1970-01-01T00:00:00</DateAwarded>
    <DegreeAwarded>BS</DegreeAwarded>
    <Institution>Stanford University</Institution>
  </Education>
</Educations>

I want to populate a multi-valued field with text as below -

BS, Stanford University, 1970
MD, Harvard University, 1975
SM, University of Chicago, 1982

How can this be implemented. I am trying this with feeds and feeds tamper, looks tricky.

Comments

jadhavdevendra created an issue. See original summary.

MegaChriz’s picture

Status: Active » Fixed

This should indeed be done with Feeds Tamper.

I would probably try something like this:

  1. Define three sources, one for each XML element inside "Education".
  2. Apply "Find replace REGEX" plugin on "DateAwarded" to only get the year.
  3. Use the "Rewrite" plugin to concat the three sources.

If that doesn't work (for example if result of the "Find replace REGEX" doesn't get passed to the "Rewrite" plugin"), I would try this:

  1. Create one source that contains raw XML of "Education".
  2. Use the "Find replace REGEX" plugin to concat everything together. This requires that the XML elements always inside "Education" need to be in the same order. Something like this (untested):
    Regex:
    /.*\<DateAwarded\>(.*)\<\/DateAwarded\>.*\<DegreeAwarded\>(.*)\<\/DegreeAwarded\>.*\<Institution\>(.*)\<\/Institution\>/
    

    Replacement:

    ${2}, ${3}, ${1}
    

Status: Fixed » Closed (fixed)

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