PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Simple XML - difficult parsing
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Simple XML - difficult parsing

Réponse
 
LinkBack Outils de la discussion
Vieux 28/03/2008, 21h31   #1
GorseFox
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Simple XML - difficult parsing

I have been using Simple-XML in PHP 5.2.5 to try and parse an RSS feed
from feedburner. Most of what I want has worked just fine... except
the attempt to extract the content from the tag
"<feedburnerrigLink>".

As an example, this tag contains:
<feedburnerrigLink>http://someblog.blogspot.com/2008/03/
php.html</feedburnerrigLink>

Because this tag uses a special character I used:

$item_origlink = (string) $item->{'feedburnerrigLink'};
echo "<p>Original link was: ", $item_origlink , "</p>";

but I never seem to get the content of the tag.

Can anyone offer any suggestions?

Thanks in advance
  Réponse avec citation
Vieux 29/03/2008, 01h43   #2
petersprc
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Simple XML - difficult parsing

Hi,

You can use the children or xpath methods to access elements with
prefixed names. Those nodes can't be accessed through the arrow (->)
operator. Examples:

// Get children that are qualified with the feedburner namespace

$feedElems = $elem->children('http://rssnamespace.org/feedburner/ext/
1.0')

// Get all origLink elements in the whole document

$links = $elem->xpath('//feedburnerrigLink');

// Get all origLink descendents of a node

$links = $elem->xpath('elem//feedburnerrigLink');

// Get origLink children

$links = $elem->xpath('elem/feedburnerrigLink');

Regards,

John Peters

On Mar 28, 4:31 pm, GorseFox <andy.mcmen...@gmail.com> wrote:
> I have been using Simple-XML in PHP 5.2.5 to try and parse an RSS feed
> from feedburner. Most of what I want has worked just fine... except
> the attempt to extract the content from the tag
> "<feedburnerrigLink>".
>
> As an example, this tag contains:
> <feedburnerrigLink>http://someblog.blogspot.com/2008/03/
> php.html</feedburnerrigLink>
>
> Because this tag uses a special character I used:
>
> $item_origlink = (string) $item->{'feedburnerrigLink'};
> echo "<p>Original link was: ", $item_origlink , "</p>";
>
> but I never seem to get the content of the tag.
>
> Can anyone offer any suggestions?
>
> Thanks in advance


  Réponse avec citation
Vieux 30/03/2008, 10h56   #3
GorseFox
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Simple XML - difficult parsing

On Mar 29, 1:43 am, petersprc <peters...@gmail.com> wrote:
> Hi,
>
> You can use the children or xpath methods to access elements with
> prefixed names. Those nodes can't be accessed through the arrow (->)
> operator. Examples:
>
> // Get children that are qualified with the feedburner namespace
>
> $feedElems = $elem->children('http://rssnamespace.org/feedburner/ext/
> 1.0')
>
> // Get all origLink elements in the whole document
>
> $links = $elem->xpath('//feedburnerrigLink');
>
> // Get all origLink descendents of a node
>
> $links = $elem->xpath('elem//feedburnerrigLink');
>
> // Get origLink children
>
> $links = $elem->xpath('elem/feedburnerrigLink');
>
> Regards,
>
> John Peters
>
> On Mar 28, 4:31 pm, GorseFox <andy.mcmen...@gmail.com> wrote:
>
> > I have been using Simple-XML in PHP 5.2.5 to try and parse an RSS feed
> > from feedburner. Most of what I want has worked just fine... except
> > the attempt to extract the content from the tag
> > "<feedburnerrigLink>".

>
> > As an example, this tag contains:
> > <feedburnerrigLink>http://someblog.blogspot.com/2008/03/
> > php.html</feedburnerrigLink>

>
> > Because this tag uses a special character I used:

>
> > $item_origlink = (string) $item->{'feedburnerrigLink'};
> > echo "<p>Original link was: ", $item_origlink , "</p>";

>
> > but I never seem to get the content of the tag.

>
> > Can anyone offer any suggestions?

>
> > Thanks in advance


Thanks for the clues... I will be away for a few days, but will pick
up on this when I return.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h18.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,75435 seconds with 11 queries