Article View: fr.comp.text.xml
Article #9267Re: [XPath] Petit probleme pour r�cup�rer la valeur d'un attribut
From: Luc Saint-Elie
Date: Tue, 08 May 2001 15:26
Date: Tue, 08 May 2001 15:26
56 lines
2554 bytes
2554 bytes
Bonne remaruqye, je voudrais la valeur de l'id du lien en corus dans
une boucle foreach :
[...]
foreach ( $liste_des_menus as $menu ) {
$liste_des_lien = $xml->evaluate("//lien");
}
foreach ($liste_des_lien as $lien) {
$xml->get_content($lien."/intitule[1]");
$lienid =$xml->evaluate ("select=/navigation/menu/lien/@id");
$array_menu = array('id'=>$lienid,
'url'=>$xml->get_content($lien."/url[1]"),
'intitule'=>$xml->get_content($lien."/intitule[1]")
);
array_push($array_liste_menus,$array_menu);
}
Au final je voudrais r�cup�rer dans un array() (j'utilsie un syst�me
de templates) un array donc avec : id, url, intitul�
La r�cup�ration de l'url et de l'intitul� se font sans probl�me..mais
que dalle pour la valeur de l'id
Luc
On 08 May 2001 13:22:27 +0200, Alain Ketterlin
<alain@dpt-info.u-strasbg.fr> wrote:
>Luc Saint-Elie <luc@saint-elie.com> writes:
>
>> <?xml version="1.0" encoding="iso-8859-1"?>
>>
>> <navigation>
>> <menu name="navHaut">
>> <lien id="1">
>> <url>index.php</url>
>> <intitule>Accueil</intitule>
>> </lien>
>> <lien id="2">
>> <url>index.php?op=surleweb</url>
>> <intitule>Ailleurs sur Internet</intitule>
>> </lien>
>>
>> [.... etc..]
>>
>> Je n'arrive pas � �crire la commande XPath pour r�cup�rer la valeur de
>> l'id de <lien>
>
>L'id de quel lien ?
>
>Si tu les veux tous : /navigation/menu/lien/@id
>
>-- Alain.
Technical Details
Message-ID:
<mf4gft0iudmffc170imc85la5d0n5oe7vi@4ax.com>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!proxad.net!feeder2-1.proxad.net!nnrp3.proxad.net.POSTED!not-for-mailReferences:
<k2kfftoodb2m3q8f4s9rj7a2muev41kbc2@4ax.com> <wyd79kccgc.fsf@polya.u-strasbg.fr>Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII X-Google-Thread: 114f60,e58eb35aa5a0636 X-Google-Attributes: gid114f60,public X-Google-ArrivalTime: 2001-05-08 08:26:55 PST Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!proxad.net!feeder2-1.proxad.net!nnrp3.proxad.net.POSTED!not-for-mail From: Luc Saint-Elie <luc@saint-elie.com> Newsgroups: fr.comp.text.xml Subject: Re: [XPath] Petit probleme pour r�cup�rer la valeur d'un attribut Organization: Saint-Elie Reply-To: luc@saint-elie.com Message-ID: <mf4gft0iudmffc170imc85la5d0n5oe7vi@4ax.com> References: <k2kfftoodb2m3q8f4s9rj7a2muev41kbc2@4ax.com> <wyd79kccgc.fsf@polya.u-strasbg.fr> X-Newsreader: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 57 Date: Tue, 08 May 2001 15:26:55 GMT NNTP-Posting-Host: 195.132.202.86 X-Complaints-To: abuse@proxad.net X-Trace: nnrp3.proxad.net 989335615 195.132.202.86 (Tue, 08 May 2001 17:26:55 CEST) NNTP-Posting-Date: Tue, 08 May 2001 17:26:55 CEST