par
McCallum » 28 oct. 2015, 23:37
Bonsoir,
Je souhaite importer certains attributs XML-TEI dans un BD mysql existante.
Pour le moment, je cherche ces attributs avec xpath de SimpleXML.
Je suis complètement néophyte, donc je tâtonne.
Est-ce que la classe SimpleXMLElement::xpath est correcte ?
<?php
$string = <<<XML
<w type="headword" subtype="unvocalized">šbʿ</w>
XML;
$xml = new SimpleXMLElement($string);
/* ici je cherche @headword */
$result = $xml->xpath('headword');
while(list( , $node) = each($result)) {
echo 'headword: ',$node,"\n";
}
?>
Manifestement, j'ai dû faire une erreur car rien de s'affiche, alors pour que @type headword
šbʿ devrait s'afficher.
Une suggestion ?
D'avance, merci.
McCallum
Bonsoir,
Je souhaite importer certains attributs XML-TEI dans un BD mysql existante.
Pour le moment, je cherche ces attributs avec xpath de SimpleXML.
Je suis complètement néophyte, donc je tâtonne.
Est-ce que la classe SimpleXMLElement::xpath est correcte ?
[php]<?php
$string = <<<XML
<w type="headword" subtype="unvocalized">šbʿ</w>
XML;
$xml = new SimpleXMLElement($string);
/* ici je cherche @headword */
$result = $xml->xpath('headword');
while(list( , $node) = each($result)) {
echo 'headword: ',$node,"\n";
}
?>[/php]
Manifestement, j'ai dû faire une erreur car rien de s'affiche, alors pour que @type headword [u]šbʿ[/u] devrait s'afficher.
Une suggestion ?
D'avance, merci.
McCallum