CodeIgniter v4.5 API

XMLFormatter
in package
implements FormatterInterface

XML data formatter

Tags
see
XMLFormatterTest

Table of Contents

Interfaces

FormatterInterface
Formatter interface

Methods

format()  : false|string
Takes the given data and formats it.
arrayToXML()  : void
A recursive method to convert an array into a valid XML string.
normalizeXMLTag()  : string
Normalizes tags into the allowed by W3C.

Methods

format()

Takes the given data and formats it.

public format(array<string|int, mixed>|bool|float|int|object|string|null $data) : false|string
Parameters
$data : array<string|int, mixed>|bool|float|int|object|string|null
Return values
false|string

(XML string | false)

arrayToXML()

A recursive method to convert an array into a valid XML string.

protected arrayToXML(array<string|int, mixed> $data, SimpleXMLElement &$output) : void

Written by CodexWorld. Received permission by email on Nov 24, 2016 to use this code.

Parameters
$data : array<string|int, mixed>
$output : SimpleXMLElement
Tags
see
http://www.codexworld.com/convert-array-to-xml-in-php/

        
On this page

Search results