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
Afficher le fichier Open project: symfony/symfony Class Usage Examples

Méthodes publiques

Méthode 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 )

Méthodes protégées

Méthode 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

Méthode 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 méthode

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 méthode

final protected appendCData ( DOMNode $node, string $val ) : boolean
$node DOMNode
$val string
Résultat boolean

appendDocumentFragment() final protected méthode

final protected appendDocumentFragment ( DOMNode $node, DOMDocumentFragment $fragment ) : boolean
$node DOMNode
$fragment DOMDocumentFragment
Résultat boolean

appendText() final protected méthode

final protected appendText ( DOMNode $node, string $val ) : boolean
$node DOMNode
$val string
Résultat boolean

appendXMLString() final protected méthode

final protected appendXMLString ( DOMNode $node, string $val ) : boolean
$node DOMNode
$val string
Résultat boolean

decode() public méthode

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

encode() public méthode

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

getRootNodeName() public méthode

Returns the root node name.
public getRootNodeName ( ) : string
Résultat string

isElementNameValid() final protected méthode

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

setRootNodeName() public méthode

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

supportsDecoding() public méthode

public supportsDecoding ( $format )

supportsEncoding() public méthode

public supportsEncoding ( $format )