xml parsing error, using php's asxml

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pano pano
    New Member
    • Nov 2011
    • 18

    xml parsing error, using php's asxml

    Code:
    $file = simplexml_load_file($url); {
    
    
        foreach($file->entry as $post) {
    
    
        $row = simplexml_load_string($post->asXML()); // after adding this line, i get error message
    
        $links = $row->xpath('//link[@rel="alternate" and @type="text/html"]');
        echo (string) $post->title;
        echo (string) $links[0]['href'];
    I use this script to parse atom feed. At first didn't work because it couldn't pass the link's href attribute properly. I added $row and even though it worked, it gives an error : "namespace prefix gd for etag on entry is not defined". I'm searching this for hours, can't find a solution. Can anyone help please?
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    then you haven’t searched properly. it is known that SimpleXML doesn’t use Namespaces by default and how to incorporate them is an easy search.

    Comment

    Working...