Documentation

XMLConverter
in package

Converts tabular data into a DOMDocument object.

Table of Contents

Properties

$column_attr  : string
XML column attribute name.
$field_name  : string|null
XML Item name.
$formatter  : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 callable(array<string|int, mixed>, Array): array<string|int, mixed>|null
$offset_attr  : string
XML offset attribute name.
$record_name  : string
XML Node name.
$root_name  : string
XML Root name.

Methods

__construct()  : mixed
convert()  : DOMDocument
DEPRECATION WARNING! This method will be removed in the next major point release.
create()  : self
DEPRECATION WARNING! This method will be removed in the next major point release.
download()  : int|false
Sends and makes the XML structure downloadable via HTTP.
fieldElement()  : self
XML Field element setter.
formatter()  : self
Set a callback to format each item before json encode.
import()  : DOMElement|Element
Creates a new DOMElement related to the given DOMDocument.
recordElement()  : self
XML Record element setter.
rootElement()  : self
XML root element setter.
supportsHeader()  : bool
when()  : self
Apply the callback if the given "condition" is (or resolves to) true.
fieldToElement()  : DOMElement|Element
Converts Cell to Item.
filterAttributeName()  : string
Filters XML attribute name.
filterElementName()  : string|null
Filters XML element name.
recordToElement()  : DOMElement|Element
Converts a CSV record into a DOMElement and adds its offset as DOMElement attribute.
newXmlDocument()  : DOMDocument|XMLDocument

Properties

$column_attr

XML column attribute name.

protected string $column_attr = ''

$field_name

XML Item name.

protected string|null $field_name = 'cell'

$formatter

protected Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 callable(array<string|int, mixed>, Array): array<string|int, mixed>|null $formatter = null

$offset_attr

XML offset attribute name.

protected string $offset_attr = ''

$record_name

XML Node name.

protected string $record_name = 'row'

$root_name

XML Root name.

protected string $root_name = 'csv'

Methods

create()

DEPRECATION WARNING! This method will be removed in the next major point release.

public static create() : self

Since version 9.22.0

use League\Csv\XMLConverter::__construct()

Tags
see
XMLConverter::__construct()
codeCoverageIgnore

Returns an new instance.

Return values
self

download()

Sends and makes the XML structure downloadable via HTTP.

public download(TabularDataProvider|TabularData|iterable<string|int, mixed> $records[, string|null $filename = null ][, string $encoding = 'utf-8' ][, bool $formatOutput = false ]) : int|false

. Returns the number of characters read from the handle and passed through to the output.

Parameters
$records : TabularDataProvider|TabularData|iterable<string|int, mixed>
$filename : string|null = null
$encoding : string = 'utf-8'
$formatOutput : bool = false
Tags
throws
Exception
Return values
int|false

fieldElement()

XML Field element setter.

public fieldElement(string|null $node_name[, string $fieldname_attribute_name = '' ]) : self
Parameters
$node_name : string|null
$fieldname_attribute_name : string = ''
Tags
throws
DOMException
Return values
self

formatter()

Set a callback to format each item before json encode.

public formatter( Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 callable(array<string|int, mixed>, Array): array<string|int, mixed>|null $formatter) : self
Parameters
$formatter : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 callable(array<string|int, mixed>, Array): array<string|int, mixed>|null
Return values
self

import()

Creates a new DOMElement related to the given DOMDocument.

public import(TabularDataProvider|TabularData|iterable<string|int, mixed> $records, DOMDocument|XMLDocument $doc) : DOMElement|Element

DOES NOT attach to the DOMDocument

Parameters
$records : TabularDataProvider|TabularData|iterable<string|int, mixed>
$doc : DOMDocument|XMLDocument
Return values
DOMElement|Element

recordElement()

XML Record element setter.

public recordElement(string $node_name[, string $record_offset_attribute_name = '' ]) : self
Parameters
$node_name : string
$record_offset_attribute_name : string = ''
Tags
throws
DOMException
Return values
self

rootElement()

XML root element setter.

public rootElement(string $node_name) : self
Parameters
$node_name : string
Tags
throws
DOMException
Return values
self

supportsHeader()

public static supportsHeader(array<string|int, mixed> $header) : bool
Parameters
$header : array<string|int, mixed>
Return values
bool

when()

Apply the callback if the given "condition" is (or resolves to) true.

public when(callable($this): bool|bool $condition, Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 78 callable($this): Array $onSuccess[, Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 78 callable($this): Array|null $onFail = null ]) : self
Parameters
$condition : callable($this): bool|bool
$onSuccess : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 78 callable($this): Array
$onFail : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 78 callable($this): Array|null = null
Return values
self

fieldToElement()

Converts Cell to Item.

protected fieldToElement(DOMDocument|XMLDocument $document, string $value, int|string $node_name) : DOMElement|Element

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

Parameters
$document : DOMDocument|XMLDocument
$value : string
$node_name : int|string
Return values
DOMElement|Element

filterAttributeName()

Filters XML attribute name.

protected filterAttributeName(string $value) : string
Parameters
$value : string

Element name

Tags
throws
DOMException

If the Element attribute name is invalid

Return values
string

filterElementName()

Filters XML element name.

protected filterElementName(string|null $value) : string|null
Parameters
$value : string|null
Tags
throws
DOMException

If the Element name is invalid

Return values
string|null

recordToElement()

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

protected recordToElement(DOMDocument|XMLDocument $document, array<string|int, mixed> $record, int $offset) : DOMElement|Element
Parameters
$document : DOMDocument|XMLDocument
$record : array<string|int, mixed>
$offset : int
Return values
DOMElement|Element

newXmlDocument()

private static newXmlDocument(string $xml_class) : DOMDocument|XMLDocument
Parameters
$xml_class : string
Tags
throws
RuntimeException

If the extension is not present

throws
ValueError

If the XML class used is invalid

Return values
DOMDocument|XMLDocument

        
On this page

Search results