Great module! I can successfully import XML and create nodes via the import. Is it possible to import to multiple content types? I see that you can only process to one node type by default. In my XML file I have data that needs to be mapped into 2 node types.

Is this possible? Any suggestions?

Comments

ambientdrup’s picture

I located another module that does this: xml2node: http://drupal.org/project/xml2node.

I'm going to try structuring my XML document similar to how xml2node requires it to be structured in order to import to multiple types (from same XML file); and then try running another import using Feeds XPath.

xml2node also supports node reference fields.

twistor’s picture

Assigned: Unassigned » twistor
Status: Active » Closed (works as designed)

The easiest way would be to set up multiple importers one attached to each content type. This module doesn't handle the mapping. You could use this to map to users or taxonomy terms if you wanted. You might want to post a question on feeds but that seems like a pretty big architectural change.

Problue Solutions’s picture

Subscribe

twistor’s picture

Anyone want to give this a try? http://drupal.org/sandbox/twistor/1135898

eneko1907’s picture

Interesting functionality request indeed.

Sometimes content is encapsulated in XML, in the process content is de-normalized. Consumers of such XML files want to normalize the content again. Example:

<xml>
<title>multi artist cd</title>
<body>a description of the CD</body>
<track>
  <author>first track author</author>
  <author>other author for the first track</author>
  <song> the song title</song>
</track>
<track>
  <author>second track author</author>
  <author>other author for the second track</author>
  <song>the song title for track 2</song>
</track>
</xml>

You can envision having a content type for authors, and a content type for songs.

Yet, both need to be related (a song has authors, and viceversa).
author CCT (name, and node_reference fields)
song CCT (title, and node referrer (or other node reference))

@ambientdrup points to the xml2node module, which in itself is interesting, but for this use, one would have to transform the XML to make it conform to the drupal-template schema that xml2node understands. It seems that I would have to extend the module to understand other XML schemas.

@twistor points to a sandbox module that may be super cool, unfortunately, only would work in a D7 instance, and Im not yet there.

There are other interesting things -- along with the Feeds Xpath Parser, there is the "Mapper for Node reference" patch (see http://drupal.org/node/724536). This may get us closer to the functionality, as it creates the relations to other content types. But still, one would like something like having the cck_fields of the referenced content type available in the select list within the mapping settings.

In sort, instead of mapping content to 1->n type of fields in the same content type, we mapr but these 1-> many XML fields are in other content type.

The problem is well stated by @ambientdrup, but I would go a step further and request that the inherent relationship in the XML is preserved using node reference fields. It would be a way to reconstruct fully relational databases that are de-normalized when exposed through web services, or ported using complex XML schemas, etc.

Great module, thanks a lot.
Inigo

twistor’s picture

There is now a 6.x version of the multi-node processor if you're interested.

eneko1907’s picture

@twistor,

Yes Im v. interested -- I think you are referring to your sandbox project, i just checked out (cloned) your project, but the .info specifies the Feeds Multi-node Processor is for core = 7.x. I looked a bit under your projects, but couldnt find the 6.x branch. Im assuming you are not referring to the Multi-source processor, etc.

Thank you very much,
inigo

hawkeye.twolf’s picture

Issue summary: View changes