\League\CsvXMLConverter

Converts tabular data into a DOMDOcument object.

Summary

Methods
Properties
Constants
convert()
import()
rootElement()
recordElement()
fieldElement()
No public properties found
No constants found
recordToElementWithAttribute()
recordToElement()
fieldToElementWithAttribute()
fieldToElement()
filterElementName()
filterAttributeName()
$root_name
$record_name
$field_name
$column_attr
$offset_attr
$encoder
N/A
No private methods found
No private properties found
N/A

Properties

$root_name

$root_name : string

XML Root name.

Type

string

$record_name

$record_name : string

XML Node name.

Type

string

$field_name

$field_name : string

XML Item name.

Type

string

$column_attr

$column_attr : string

XML column attribute name.

Type

string

$offset_attr

$offset_attr : string

XML offset attribute name.

Type

string

$encoder

$encoder : array

Conversion method list.

Type

array

Methods

convert()

convert(array|\Traversable  $records) 

Convert a Record collection into a DOMDocument.

Parameters

array|\Traversable $records

the CSV records collection

import()

import(array|\Traversable  $records, \DOMDocument  $doc) 

Create a new DOMElement related to the given DOMDocument.

DOES NOT attach to the DOMDocument

Parameters

array|\Traversable $records
\DOMDocument $doc

rootElement()

rootElement(\League\Csv\string  $node_name) 

XML root element setter.

Parameters

\League\Csv\string $node_name

recordElement()

recordElement(\League\Csv\string  $node_name, \League\Csv\string  $record_offset_attribute_name = '') 

XML Record element setter.

Parameters

\League\Csv\string $node_name
\League\Csv\string $record_offset_attribute_name

fieldElement()

fieldElement(\League\Csv\string  $node_name, \League\Csv\string  $fieldname_attribute_name = '') 

XML Field element setter.

Parameters

\League\Csv\string $node_name
\League\Csv\string $fieldname_attribute_name

recordToElementWithAttribute()

recordToElementWithAttribute(\DOMDocument  $doc, array  $record, \League\Csv\string  $field_encoder, \League\Csv\int  $offset) 

Convert a CSV record into a DOMElement and adds its offset as DOMElement attribute.

Parameters

\DOMDocument $doc
array $record
\League\Csv\string $field_encoder
\League\Csv\int $offset

recordToElement()

recordToElement(\DOMDocument  $doc, array  $record, \League\Csv\string  $field_encoder) 

Convert a CSV record into a DOMElement.

Parameters

\DOMDocument $doc
array $record
\League\Csv\string $field_encoder

fieldToElementWithAttribute()

fieldToElementWithAttribute(\DOMDocument  $doc, \League\Csv\string  $value, integer|string  $node_name) 

Convert Cell to Item.

Convert the CSV item into a DOMElement and adds the item offset as attribute to the returned DOMElement

Parameters

\DOMDocument $doc
\League\Csv\string $value
integer|string $node_name

fieldToElement()

fieldToElement(\DOMDocument  $doc, string  $value) 

Convert Cell to Item.

Parameters

\DOMDocument $doc
string $value

Record item value

filterElementName()

filterElementName(\League\Csv\string  $value) 

Filter XML element name.

Parameters

\League\Csv\string $value

Throws

\DOMException

If the Element name is invalid

filterAttributeName()

filterAttributeName(string  $value) 

Filter XML attribute name.

Parameters

string $value

Element name

Throws

\DOMException

If the Element attribute name is invalid