ArrayToXml
Table of Contents
Properties
-
$addXmlDeclaration
: bool
-
$document
: DOMDocument
-
$numericTagNamePrefix
: string
-
$options
: array<string|int, mixed>
-
$replaceSpacesByUnderScoresInKeyNames
: bool
-
$rootNode
: DOMElement
Methods
-
__construct()
: mixed
-
addProcessingInstruction()
: self
-
convert()
: string
-
dropXmlDeclaration()
: self
-
prettify()
: self
-
setDomProperties()
: self
-
setNumericTagNamePrefix()
: void
-
toDom()
: DOMDocument
-
toXml()
: string
-
addAttributes()
: void
-
addCollectionNode()
: void
-
addNode()
: void
-
addNodeTypeAttribute()
: void
-
addNumericNode()
: void
-
addSequentialNode()
: void
-
convertElement()
: void
-
convertNodeValue()
: mixed
-
createRootElement()
: DOMElement
-
ensureValidDomProperties()
: void
-
isArrayAllKeySequential()
: bool
-
removeControlCharacters()
: string
$addXmlDeclaration
protected
bool
$addXmlDeclaration
= true
$document
protected
DOMDocument
$document
$numericTagNamePrefix
protected
string
$numericTagNamePrefix
= 'numeric_'
$options
protected
array<string|int, mixed>
$options
= ['convertNullToXsiNil' => false, 'convertBoolToString' => false]
$replaceSpacesByUnderScoresInKeyNames
protected
bool
$replaceSpacesByUnderScoresInKeyNames
= true
$rootNode
protected
DOMElement
$rootNode
__construct()
public
__construct(array<string|int, mixed> $array[, string|array<string|int, mixed> $rootElement = '' ][, bool $replaceSpacesByUnderScoresInKeyNames = true ][, string|null $xmlEncoding = null ][, string $xmlVersion = '1.0' ][, array<string|int, mixed> $domProperties = [] ][, bool|null $xmlStandalone = null ][, bool $addXmlDeclaration = true ][, array<string|int, mixed>|null $options = ['convertNullToXsiNil' => false, 'convertBoolToString' => false] ]) : mixed
Parameters
-
$array
: array<string|int, mixed>
-
-
$rootElement
: string|array<string|int, mixed>
= ''
-
-
$replaceSpacesByUnderScoresInKeyNames
: bool
= true
-
-
$xmlEncoding
: string|null
= null
-
-
$xmlVersion
: string
= '1.0'
-
-
$domProperties
: array<string|int, mixed>
= []
-
-
$xmlStandalone
: bool|null
= null
-
-
$addXmlDeclaration
: bool
= true
-
-
$options
: array<string|int, mixed>|null
= ['convertNullToXsiNil' => false, 'convertBoolToString' => false]
-
addProcessingInstruction()
public
addProcessingInstruction(string $target, string $data) : self
Parameters
-
$target
: string
-
-
$data
: string
-
convert()
public
static convert(array<string|int, mixed> $array[, mixed $rootElement = '' ][, bool $replaceSpacesByUnderScoresInKeyNames = true ][, string|null $xmlEncoding = null ][, string $xmlVersion = '1.0' ][, array<string|int, mixed> $domProperties = [] ][, bool|null $xmlStandalone = null ][, bool $addXmlDeclaration = true ][, array<string|int, mixed> $options = ['convertNullToXsiNil' => false] ]) : string
Parameters
-
$array
: array<string|int, mixed>
-
-
$rootElement
: mixed
= ''
-
-
$replaceSpacesByUnderScoresInKeyNames
: bool
= true
-
-
$xmlEncoding
: string|null
= null
-
-
$xmlVersion
: string
= '1.0'
-
-
$domProperties
: array<string|int, mixed>
= []
-
-
$xmlStandalone
: bool|null
= null
-
-
$addXmlDeclaration
: bool
= true
-
-
$options
: array<string|int, mixed>
= ['convertNullToXsiNil' => false]
-
dropXmlDeclaration()
public
dropXmlDeclaration() : self
prettify()
public
prettify() : self
setDomProperties()
public
setDomProperties(array<string|int, mixed> $domProperties) : self
Parameters
-
$domProperties
: array<string|int, mixed>
-
setNumericTagNamePrefix()
public
setNumericTagNamePrefix(string $prefix) : void
Parameters
-
$prefix
: string
-
toDom()
public
toDom() : DOMDocument
Return values
DOMDocument
toXml()
public
toXml([mixed $options = 0 ]) : string
Parameters
-
$options
: mixed
= 0
-
addAttributes()
protected
addAttributes(DOMElement $element, array<string|int, mixed> $data) : void
Parameters
-
$element
: DOMElement
-
-
$data
: array<string|int, mixed>
-
addCollectionNode()
protected
addCollectionNode(DOMElement $element, mixed $value) : void
Parameters
-
$element
: DOMElement
-
-
$value
: mixed
-
addNode()
protected
addNode(DOMElement $element, string $key, mixed $value) : void
Parameters
-
$element
: DOMElement
-
-
$key
: string
-
-
$value
: mixed
-
addNodeTypeAttribute()
protected
addNodeTypeAttribute(DOMElement $element, mixed $value) : void
Parameters
-
$element
: DOMElement
-
-
$value
: mixed
-
addNumericNode()
protected
addNumericNode(DOMElement $element, mixed $value) : void
Parameters
-
$element
: DOMElement
-
-
$value
: mixed
-
addSequentialNode()
protected
addSequentialNode(DOMElement $element, mixed $value) : void
Parameters
-
$element
: DOMElement
-
-
$value
: mixed
-
convertElement()
protected
convertElement(DOMElement $element, mixed $value) : void
Parameters
-
$element
: DOMElement
-
-
$value
: mixed
-
convertNodeValue()
protected
convertNodeValue(DOMElement $element, mixed $value) : mixed
Parameters
-
$element
: DOMElement
-
-
$value
: mixed
-
createRootElement()
protected
createRootElement(string|array<string|int, mixed> $rootElement) : DOMElement
Parameters
-
$rootElement
: string|array<string|int, mixed>
-
ensureValidDomProperties()
protected
ensureValidDomProperties(array<string|int, mixed> $domProperties) : void
Parameters
-
$domProperties
: array<string|int, mixed>
-
isArrayAllKeySequential()
protected
isArrayAllKeySequential(array<string|int, mixed>|string|null $value) : bool
Parameters
-
$value
: array<string|int, mixed>|string|null
-
removeControlCharacters()
protected
removeControlCharacters(string $value) : string
Parameters
-
$value
: string
-