|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 "<feedburner rigLink>".As an example, this tag contains: <feedburner rigLink>http://someblog.blogspot.com/2008/03/php.html</feedburner rigLink>Because this tag uses a special character I used: $item_origlink = (string) $item->{'feedburner rigLink'};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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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('//feedburner rigLink');// Get all origLink descendents of a node $links = $elem->xpath('elem//feedburner rigLink');// Get origLink children $links = $elem->xpath('elem/feedburner rigLink');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 > "<feedburner rigLink>".> > As an example, this tag contains: > <feedburner rigLink>http://someblog.blogspot.com/2008/03/> php.html</feedburner rigLink>> > Because this tag uses a special character I used: > > $item_origlink = (string) $item->{'feedburner rigLink'};> 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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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('//feedburner rigLink');> > // Get all origLink descendents of a node > > $links = $elem->xpath('elem//feedburner rigLink');> > // Get origLink children > > $links = $elem->xpath('elem/feedburner rigLink');> > 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 > > "<feedburner rigLink>".> > > As an example, this tag contains: > > <feedburner rigLink>http://someblog.blogspot.com/2008/03/> > php.html</feedburner rigLink>> > > Because this tag uses a special character I used: > > > $item_origlink = (string) $item->{'feedburner rigLink'};> > 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. |
|
![]() |
| Outils de la discussion | |
|
|