从其他(xml)内容自动创建drupal页面(节点)

I currently have a datasource from a client in the form of XML, this XML has content for all the pages that the website we're making will contain. Now after parsing and preparing all this content, does anyone know how we can then (using) PHP automate the creation of a drupal node (including all related fields for that node i.e. CCK fields, paths).

Ideally a function we can send all the content to and the nodes get created. Now i don't mind putting it straight into the db, but i'm not quite sure what db tables get updated (as the drupal setup has a gazillion tables).

I've searched through google and the drupal docs, but i can't really find something for this (Which i assumed would be a simple and often used function by web developers on drupal..)

Your input will be very much appreciated!

Thanks in advance,

Shadi

You can use Drupal's node_save function something like this:

require 'includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$node = new stdClass();

$node->title = "My imported node";
$node->body = "The body of my imported node.";
$node->type = 'story'; 
$node->created = time();
$node->changed = $node->created;
$node->status = 1;
$node->promote = 1;
$node->sticky = 0;
$node->format = 1;
$node->uid = 1;

node_save($node);

See this article on the Acquia site for more (including CCK fields, if you're using pathauto that should create paths on node_save): http://acquia.com/blog/migrating-drupal-way-part-i-creating-node

You should be able to use node_save() for that purpose. I haven't tried with cck fields, but if you add the fields they should be saved through the hooks run. However, if you don't create the nodetype with fields through code, the function will be dependent on the setup you do in the admin interface.

node_save works for cck if you set the right type and format fields well in the array structure.