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
__construct()
public
__construct() : mixed
convert()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
convert(TabularDataProvider|TabularData|iterable<string|int, mixed> $records) : DOMDocument
Since version 9.22.0
use League\Csv\XMLConverter::impoprt()
Parameters
- $records : TabularDataProvider|TabularData|iterable<string|int, mixed>
Tags
Return values
DOMDocumentcreate()
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
Return values
selfdownload()
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
Return values
int|falsefieldElement()
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
Return values
selfformatter()
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
selfimport()
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|ElementrecordElement()
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
Return values
selfrootElement()
XML root element setter.
public
rootElement(string $node_name) : self
Parameters
- $node_name : string
Tags
Return values
selfsupportsHeader()
public
static supportsHeader(array<string|int, mixed> $header) : bool
Parameters
- $header : array<string|int, mixed>
Return values
boolwhen()
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
selffieldToElement()
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|ElementfilterAttributeName()
Filters XML attribute name.
protected
filterAttributeName(string $value) : string
Parameters
- $value : string
-
Element name
Tags
Return values
stringfilterElementName()
Filters XML element name.
protected
filterElementName(string|null $value) : string|null
Parameters
- $value : string|null
Tags
Return values
string|nullrecordToElement()
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|ElementnewXmlDocument()
private
static newXmlDocument(string $xml_class) : DOMDocument|XMLDocument
Parameters
- $xml_class : string