PHP ETL
  • Introduction
  • Getting Started
  • Extractors
    • Collection
    • CSV
    • Fixed Width
    • JSON
    • Query
    • Table
    • XML
  • Transformers
    • Convert Case
    • JSON Decode
    • JSON Encode
    • Rename Columns
    • Trim
    • Unique Rows
  • Loaders
    • Insert
    • Insert/Update
  • Helpers
  • Running Processes
Powered by GitBook
On this page
  • Options
  • Columns
  • Loop
  1. Extractors

XML

Extracts data from an XML file.

$etl->extract('xml', 'path/to/file.xml', $options);

Options

Columns

Columns that will be extracted. If null, all tags and attributes within the loop path will be extracted.

Type

Default value

array

null

To select which columns will be extracted, use the path (without the loop path) of the value. Use @ to select attributes:

$options = ['columns' => [
    'id' => '/@id',
    'name' => '/profile/name',
    'email' => '/profile/email',
]];

Loop

The path to loop through.

Type

Default value

string

/

To select which columns will be extracted, use the path (without the loop path) of the value. Use @ to select attributes:

$options = ['loop' => '/users/user'];
PreviousTableNextTransformers

Last updated 6 years ago