About Import Pages XML

This ProcessWire module allows you to import and parse XML files (using xpath) to create or update pages.

Category 1Admin Helpers
Admin helper modules are those that provide helpful tools, UI enhancements or optimizations to the admin panel (excluding Fieldtype or Inputfield modules).
Category 2Import/Export
Modules that work with importing or exporting data.
Category 3Process Modules
Process modules are apps that run in the ProcessWire admin.
Release StateStable
Should be safe for use in production environments. *
Authorjustb3a
Module Version1.0.0
Class NameImportPagesXml
Compatibility3.0
Date AddedDecember 17, 2015
Last UpdatedSeptember 28, 2016
Recommended ByNew recommendations may take up to 1 day to appear.

Instructions

This module's files should be placed in /site/modules/ImportPagesXml/
How to install or uninstall modules

README

Import Pages From XML

This ProcessWire module allows you to import and parse XML files (using xpath) to create or update pages.

Screencast

Settings

After successfull installation go to Setup > Import Pages From XML to start using the XML Importer.

This module does not support all available field types. Nevertheless, I've refrained from restricting the supported field types because many of them should work by default.

Tested and working:

  • image including tag and description support
  • select
  • text
  • textarea
  • integer

The following field types will be ignored:

  • FieldsetTabOpen
  • FieldsetOpen
  • FieldsetClose

Not working:

  • file
  • repeater

Xpath Mappings

If you want to take advantage of references between fields in your xpath mapping then make sure the fields you're relating to are placed before the ones which need the relations.You can access and use any values/fields that you placed earlier in your file. Use $field_<fieldname> to match the desired value.

Example

<?xml version="1.0" encoding="UTF-8"?>

<songs>
    <song track="2">
        <title contact_id="1">Some song title</title>
    </song>
    <song track="7">
        <title contact_id="2">Just another song title</title>
    </song>
    <contact id="1" name="Sesmallbos" mail="info@test.org"/>
    <contact id="2" name="Sebigbos" mail="info@exam.ple"/>
</songs>
  • context: //song
  • field order: title, track, contact_id, contact_name, contact_mail
  • contact_id must be placed before contact_name and contact_mail
  • first get contact_id : title/@contact_id
  • then use that value as relation : //contact[@id="$field_artist_id"]/@name as well as //contact[@id="$field_artist_id"]/@mail

Further readings

Comments

No comments yet. Be the first to post!

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.