Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 924695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:23:56+00:00 2026-05-15T19:23:56+00:00

<?php $doc = new DOMDocument(); $doc->load(‘http://weather.yahooapis.com/forecastrss?p=VEXX0024&u=c’); $channel = $doc->getElementsByTagName(channel); foreach($channel as $chnl) { $item

  • 0
<?php
    $doc = new DOMDocument();
    $doc->load('http://weather.yahooapis.com/forecastrss?p=VEXX0024&u=c');
    $channel = $doc->getElementsByTagName("channel");
    foreach($channel as $chnl)
    {
        $item = $chnl->getElementsByTagName("item");
        foreach($item as $itemgotten)
        {
            $describe = $itemgotten->getElementsByTagName("description");
            $description = $describe->item(0)->nodeValue;
            echo $description;
        }
    }
?>

And as you can see is a simple script who return the content of the tag from the above url. The thing is that i dont need that content, i need the one who is inside the tag . I need the attributes code, temp, text. How do i do that simple with my actual code? Thanks

Ex of the tag content:

<yweather:condition  text="Partly Cloudy"  code="30"  temp="30"  date="Fri, 16 Jul 2010 8:30 am AST" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:23:57+00:00Added an answer on May 15, 2026 at 7:23 pm

    Something like:

    echo $itemgotten->getElementsByTagNameNS(
        "http://xml.weather.yahoo.com/ns/rss/1.0","condition")->item(0)->
         getAttribute("temp");
    

    The key is that you have to use getElementsByTagNameNS instead of getElementsByTagName and specify "http://xml.weather.yahoo.com/ns/rss/1.0" as the namespace.

    You know yweather is a shortcut for http://xml.weather.yahoo.com/ns/rss/1.0 because the XML file includes a xmls attribute:

    <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0"
        xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i just got an account at: http://www.whoisxmlapi.com/index.php#/whois-api-doc.php?rid=1 ive never parsed XML with c#, how
I use Jsoup to post a form like: Document doc = Jsoup.connect(http://www.example.com/post.php) .data(titolo, titolo)
I am trying to use the tranlsation webservice from MyMemory: http://mymemory.translated.net/doc/spec.php Unfortunately, Zend_Soap_Client does
I am using the following function in php to load an xml doc into
I am trying to utilize the example cited here: http://www.physicsforums.com/showthread.php?t=248191 I wrote a simple
Doing something like this: <?php $my_query = new WP_Query('category_name=process&posts_per_page=20'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate
I'm using the JQuery AJAX function to deliver data to a PHP doc. Currently,
I'm hesitating whether or not to use this mechanism. PHP Doc says autoloading is
Does someone know how to query a graphml document with php, DomDocument and DomXpath?
http://www.dsebd.org/latest_PE.php The above url contain several information .From this url i just want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.