Results 1 to 8 of 8

Thread: XML namespaces reading problem in PHP

  1. #1
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default XML namespaces reading problem in PHP

    Hi,

    Can't read namespaces fields "issuu" to the following XML by PHP -

    Please help me.Thanks.

    -----------XML code-------------
    <?xml version="1.0" encoding="UTF-8"?>
    <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:issuu="http://www.issuu.com/opensearchrss/1.0/" xmlns:media="http://search.yahoo.com/mrss/" version="2.0" issuu:id="6cf1df7d-a43c-47f5-a06c-b2bbb0a5c304" issuu:type="folder">
    <channel>
    <title>
    contractor
    </title>
    <description>
    georgia contractor
    </description>
    <link>
    http://issuu.com
    </link>
    <lastBuildDate>
    Sat, 20 Aug 2011 19:23:42 GMT
    </lastBuildDate>
    <atom:link href="http://feed.issuu.com/folder/6cf1df7d-a43c-47f5-a06c-b2bbb0a5c304/rss20.xml" rel="self" type="application/rss+xml"/>
    <issuu:fields>
    <issuu:field name="username" value="a4inc"/>
    <issuu:field name="folderId" value="6cf1df7d-a43c-47f5-a06c-b2bbb0a5c304"/>
    <issuu:field name="items" value="2"/>
    </issuu:fields>
    <item>
    <guid>
    http://issuu.com/a4inc/docs/contract...e_august2011/1
    </guid>
    <title>
    The Georgia Contractor - July/August
    </title>
    <description>
    July/August
    </description>
    <link>
    http://issuu.com/a4inc/docs/contract...e_august2011/1
    </link>
    <pubDate>
    Fri, 19 Aug 2011 17:50:51 GMT
    </pubDate>
    <content:encoded>
    Webqueue Solutions
    </content:encoded>
    <media:content url="http://image.issuu.com/110729155513-54ef1ffe5df44ff88b030064d123f083/jpg/page_1_thumb_large.jpg"/>
    <media:thumbnail url="http://image.issuu.com/110729155513-54ef1ffe5df44ff88b030064d123f083/jpg/page_1_thumb_medium.jpg"/>
    <issuuage number="1"/>
    <issuu:fields>
    <issuu:field name="title" value="The Georgia Contractor - July/August"/>
    <issuu:field name="type" value="bookmark"/>
    <issuu:field name="documentId" value="110729155513-54ef1ffe5df44ff88b030064d123f083"/>
    <issuu:field name="name" value="contractormagazine_august2011"/>
    <issuu:field name="user" value="a4inc"/>
    <issuu:field name="description" value="July/August"/>
    <issuu:field name="created" value="2011-08-19T17:50:51.000Z"/>
    </issuu:fields>
    </item>
    <item>
    <guid>
    http://issuu.com/a4inc/docs/contractor_mayjune20111/1
    </guid>
    <title>
    contractor_mayjune2011
    </title>
    <description>
    The Georgia THE VOICE OF THE CONSTRUCTION INDUSTRY OF GEORGIA May | June 2011 Volume 7, Issue 3
    </description>
    <link>
    http://issuu.com/a4inc/docs/contractor_mayjune20111/1
    </link>
    <pubDate>
    Fri, 19 Aug 2011 17:50:25 GMT
    </pubDate>
    <content:encoded>
    Webqueue Solutions
    </content:encoded>
    <media:content url="http://image.issuu.com/110804204444-968f0f5d3f1b4b999cb4ffde7948ba32/jpg/page_1_thumb_large.jpg"/>
    <media:thumbnail url="http://image.issuu.com/110804204444-968f0f5d3f1b4b999cb4ffde7948ba32/jpg/page_1_thumb_medium.jpg"/>
    <issuuage number="1"/>
    <issuu:fields>
    <issuu:field name="title" value="contractor_mayjune2011"/>
    <issuu:field name="type" value="bookmark"/>
    <issuu:field name="documentId" value="110804204444-968f0f5d3f1b4b999cb4ffde7948ba32"/>
    <issuu:field name="name" value="contractor_mayjune20111"/>
    <issuu:field name="user" value="a4inc"/>
    <issuu:field name="description" value="The Georgia THE VOICE OF THE CONSTRUCTION INDUSTRY OF GEORGIA May | June 2011 Volume 7, Issue 3"/>
    <issuu:field name="created" value="2011-08-19T17:50:25.000Z"/>
    </issuu:fields>
    </item>
    </channel>
    </rss>
    -------------------end XML code-----------------------
    Last edited by Aniruddhya Hazra; 08-23-2011 at 08:29 AM.

  2. #2
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Here is the original feeds source
    http://feed.issuu.com/folder/6cf1df7...c304/rss20.xml

    Thanks.

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Your question is unclear.
    Please provide more information, and be as specific as possible.
    • What do you want to accomplish?
    • What have you already tried?
    • What problems did you encounter?

    Also, please be sure that you have included all relevant code and/or a link to the page in question.


    you don't offer any php code, or even mention what you're using to try to read the xml. DOMDocument? SimpleXML? please give a better explanation of your problem.

  4. #4
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I have sorted it out. It's working now. Bellow is the code. I wanted to read the "issuu" fields from the RSS feed I pasted to my first post. Thanks to all.

    <?php
    $dom=new DOMDocument();
    $dom->load("rss20.xml");
    $xpath = new DomXPath($dom);
    $xpath->registerNamespace('issuu', "http://www.issuu.com/opensearchrss/1.0/");
    $query = '/rss/channel/item/issuu:fields/issuu:field[@name="documentId"]/@value';
    $results = $xpath->query($query, $dom);
    foreach($results as $result)
    {
    echo $result->nodeValue.'1<br/>';
    }
    ?>

  5. #5
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Since this issue is now resolved, please mark the thread as Resolved to communicate to other members that this is no longer pending.
    - Josh

  6. #6
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    From where to mark it? I do not find option. Please let me know.

    Thanks.

  7. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    click [ edit ] on your first post, then click [go advanced].
    next to the post tile there is a drop-down box labeled "Prefix:"; select the option that says "Resolved".

  8. #8
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Ok I have done it. Thank you.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •