[development] Simple XML Import

Jeremy Epstein jazepstein at gmail.com
Wed Jan 3 23:38:32 UTC 2007


Hi Dave,

I am interested in seeing your work, and I'm sure that others are as
well. If you'd like to get the ball rolling for eventually
contributing your import work to Drupal, it would be great if you
could post a link to where we can look at your code.

You are also most welcome to jump in on the import / export API
project, and to see if your work so far can in some way improve or
enhance it.

Also, have you looked at some of the other XML import modules
available? (e.g. node_import, taxonomy_xml)

Cheers,
Jaza.

On 1/4/07, Dave Fletcher <fletch at splendora.com> wrote:
> Hi all.
>
> I created a quick XML import method and I'm wondering if others are
> interested in it.
>
> This thing defines a simple XML format with tags: drupal (doc element),
> vocab, term, user, node, comment. It imports each of these things by
> calling the relevant xxx_save() function. Each of those tags can define
> a "fields" child element. The children of <fields> are turned into
> object, array, or primitive values and passed to the save func. Node
> elements located inside term elements are categorized by that term.
>
> The system holds a legacy ID which is mapped to a Drupal ID. It is used
> to ensure a piece of content is not imported multiple times. Therefore,
> an XML document can be updated and imported again without causing dupes.
> The system can also use this ID to reference existing content, for
> example in a uid field or the taxonomy array.
>
> Since it's just calling node_save to do all the work, this system can
> import custom node types simply by providing the right 'type' field in a
> node element and providing the fields that the custom node module
> expects. I have imported 5 different content types using this method: a
> custom review type, polls, blog (converted the mt2drupal script to this
> XML format), a custom newsletter type, and galleries.
>
> I of course know about Jaza's work on import/export API but it seemed
> like an overkill solution to me and I didn't want to really learn an
> API. I just wanted a quick XML format to do some dirty work which I
> tried to do by hand on the first rev. The XML format mainly allows me to
> inspect the data before I run the import.
>
> So my question for you, fellow Drupallers, is does this sound useful to
> you? Would it be worth my time turning this thing into a real module?
> Currently it's a command-line hack that lives in Drupal root directory
> and bootstraps. It would be neat if there was a module page, an upload
> form, and perhaps some support functions for creating the XML format
> from code.
>
> Cheers,
>
> --fletch
>
>
>


More information about the development mailing list