Documentation du code de SPIP et de ses plugins

SPIP

xml.php

Outils pour lecture de XML

Table of Contents

Constants

_SPIP_XML_TAG_SPLIT  = '{<([^:>][^>]*?)>}sS'

Functions

spip_xml_load()  : array<string|int, mixed>|bool
Lit un fichier xml donné et renvoie son arbre.
spip_xml_parse()  : array<string|int, mixed>|bool
Parse une chaine XML donnée et retourne un tableau.
spip_xml_aplatit()  : mixed
spip_xml_tagname()  : mixed
spip_xml_decompose_tag()  : mixed
spip_xml_match_nodes()  : bool
Recherche dans un arbre XML généré par `spip_xml_parse()` (ou une branche de cet arbre) les clés de l'arbre qui valident la regexp donnée.

Constants

_SPIP_XML_TAG_SPLIT

public mixed _SPIP_XML_TAG_SPLIT = '{<([^:>][^>]*?)>}sS'

Functions

spip_xml_load()

Lit un fichier xml donné et renvoie son arbre.

spip_xml_load(string $fichier[, bool $strict = true ][, bool $clean = true ][, int $taille_max = 1048576 ][, string|array<string|int, mixed> $datas = '' ][, int $profondeur = -1 ]) : array<string|int, mixed>|bool
Parameters
$fichier : string

Chemin local ou URL distante du fichier XML

$strict : bool = true

true pour râler si une balise n'est pas correctement fermée, false sinon.

$clean : bool = true

?

$taille_max : int = 1048576

Taille maximale si fichier distant

$datas : string|array<string|int, mixed> = ''

Données à envoyer pour récupérer le fichier distant

$profondeur : int = -1

?

Tags
example
include_spip('inc/xml');
$arbre = spip_xml_load("example.xml");
uses
spip_xml_parse()
Return values
array<string|int, mixed>|bool
  • array : l'arbre XML,
  • false si l'arbre xml ne peut être créé ou est vide

spip_xml_parse()

Parse une chaine XML donnée et retourne un tableau.

spip_xml_parse(string &$texte[, bool $strict = true ][, bool $clean = true ][, int $profondeur = -1 ]) : array<string|int, mixed>|bool
Parameters
$texte : string

texte XML

$strict : bool = true

true pour râler si une balise n'est pas correctement fermée, false sinon.

$clean : bool = true

?

$profondeur : int = -1

?

Tags
see
spip_xml_aplatit()

pour l'inverse

used-by
spip_xml_load()
Return values
array<string|int, mixed>|bool
  • array : l'arbre XML,
  • false si l'arbre xml ne peut être créé ou est vide

spip_xml_aplatit()

spip_xml_aplatit(mixed $arbre[, mixed $separateur = ' ' ]) : mixed
Parameters
$arbre : mixed
$separateur : mixed = ' '

spip_xml_tagname()

spip_xml_tagname(mixed $tag) : mixed
Parameters
$tag : mixed

spip_xml_decompose_tag()

spip_xml_decompose_tag(mixed $tag) : mixed
Parameters
$tag : mixed

spip_xml_match_nodes()

Recherche dans un arbre XML généré par `spip_xml_parse()` (ou une branche de cet arbre) les clés de l'arbre qui valident la regexp donnée.

spip_xml_match_nodes(string $regexp, array<string|int, mixed> &$arbre, array<string|int, mixed> &$matches[, bool $init = true ]) : bool

Les branches qui valident la regexp sont retournées dans le tableau $matches.

Parameters
$regexp : string

Expression régulière

$arbre : array<string|int, mixed>

Arbre XML

$matches : array<string|int, mixed>

Branches de l'arbre validant la rexgep

$init : bool = true

?

Tags
see
spip_xml_parse()
see
spip_xml_decompose_tag()
Return values
bool

false si aucun élément ne valide l'expression régulière, true sinon.


        
On this page

Search results