PHP Class Symfony\Component\Serializer\Encoder\XmlEncoder

Author: Jordi Boggiano ([email protected])
Author: John Wards ([email protected])
Author: Fabian Vogler ([email protected])
Inheritance: extends Symfony\Component\Serializer\Encoder\SerializerAwareEncoder, implements Symfony\Component\Serializer\Encoder\EncoderInterface, implements Symfony\Component\Serializer\Encoder\DecoderInterface, implements NormalizationAwareInterface
Datei anzeigen Open project: symfony/symfony Class Usage Examples

Public Methods

Method Description
__construct ( string $rootNodeName = 'response', integer | null $loadOptions = null ) Construct new XmlEncoder and allow to change the root node element name.
decode ( $data, $format, array $context = [] )
encode ( $data, $format, array $context = [] )
getRootNodeName ( ) : string Returns the root node name.
setRootNodeName ( string $name ) Sets the root node name.
supportsDecoding ( $format )
supportsEncoding ( $format )

Protected Methods

Method Description
appendCData ( DOMNode $node, string $val ) : boolean
appendDocumentFragment ( DOMNode $node, DOMDocumentFragment $fragment ) : boolean
appendText ( DOMNode $node, string $val ) : boolean
appendXMLString ( DOMNode $node, string $val ) : boolean
isElementNameValid ( string $name ) : boolean Checks the name is a valid xml element name.

Private Methods

Method Description
appendNode ( DOMNode $parentNode, array | object $data, string $nodeName, string $key = null ) : boolean Selects the type of node to create and appends it to the parent.
buildXml ( DOMNode $parentNode, array | object $data, string | null $xmlRootNodeName = null ) : boolean Parse the data and convert it to DOMElements.
createDomDocument ( array $context ) : DOMDocument Create a DOM document, taking serializer options into account.
needsCdataWrapping ( string $val ) : boolean Checks if a value contains any characters which would require CDATA wrapping.
parseXml ( DOMNode $node ) : array | string Parse the input DOMNode into an array or a string.
parseXmlAttributes ( DOMNode $node ) : array Parse the input DOMNode attributes into an array.
parseXmlValue ( DOMNode $node ) : array | string Parse the input DOMNode value (content and children) into an array or a string.
resolveXmlRootName ( array $context = [] ) : string Get real XML root node name, taking serializer options into account.
selectNodeType ( DOMNode $node, mixed $val ) : boolean Tests the value being passed and decide what sort of element to create.

Method Details

__construct() public method

Construct new XmlEncoder and allow to change the root node element name.
public __construct ( string $rootNodeName = 'response', integer | null $loadOptions = null )
$rootNodeName string
$loadOptions integer | null A bit field of LIBXML_* constants

appendCData() final protected method

final protected appendCData ( DOMNode $node, string $val ) : boolean
$node DOMNode
$val string
return boolean

appendDocumentFragment() final protected method

final protected appendDocumentFragment ( DOMNode $node, DOMDocumentFragment $fragment ) : boolean
$node DOMNode
$fragment DOMDocumentFragment
return boolean

appendText() final protected method

final protected appendText ( DOMNode $node, string $val ) : boolean
$node DOMNode
$val string
return boolean

appendXMLString() final protected method

final protected appendXMLString ( DOMNode $node, string $val ) : boolean
$node DOMNode
$val string
return boolean

decode() public method

public decode ( $data, $format, array $context = [] )
$context array

encode() public method

public encode ( $data, $format, array $context = [] )
$context array

getRootNodeName() public method

Returns the root node name.
public getRootNodeName ( ) : string
return string

isElementNameValid() final protected method

Checks the name is a valid xml element name.
final protected isElementNameValid ( string $name ) : boolean
$name string
return boolean

setRootNodeName() public method

Sets the root node name.
public setRootNodeName ( string $name )
$name string root node name

supportsDecoding() public method

public supportsDecoding ( $format )

supportsEncoding() public method

public supportsEncoding ( $format )