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 6477005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:53:41+00:00 2026-05-25T06:53:41+00:00

the result of the following domdocument() call $html = <<<EOT <div class=list_item> <div class=list_item_content>

  • 0

the result of the following domdocument() call

$html = <<<EOT
<div class="list_item"> 
         <div class="list_item_content"> 

            <div class="list_item_title"> 
               <a href="/link/goes/here"> 
                  INFO<br /> 
                  <span class="part2">More Info</span><br /> 
                  <span class="part3">Etc.</span> 
               </a> 
            </div> 

      </div> 
EOT;

libxml_use_internal_errors(false);

$dom = new DOMDocument();
$dom->loadhtml($html);
$xpath = new DOMXPath($dom);

$titles_nodeList = $xpath->query('//div[@class="list_item"]/div[@class="list_item_content"]/div[@class="list_item_title"]/a');

foreach ($titles_nodeList as $title) {
    $titles[] = $title->nodeValue;
}

echo("<pre>");
print_r($titles);
echo("</pre>");


?>

is

Array
(
    [0] =>  
                  INFOMore InfoEtc. 

)

Why are data in these two spans inside the a element included in the result, when I am not specifying these spans in the path? I am interested only in retrieving data contained in the a element directly, not information contained in the spans inside the a element. I am wondering what I am doing wrong.

  • 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-25T06:53:42+00:00Added an answer on May 25, 2026 at 6:53 am

    Try this xpath:

    //div[@class="list_item"]/div[@class="list_item_content"]/div[@class="list_item_title"]/a/child::text()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Facebook returns the following result: http://www.mydomain.com/some-text-here-auth-login.html?session={%22session_key%22%3A%2295da8e65851d8ec74c381171-650901429%22%2C%22uid%22%3A%22650901429%22%2C%22expires%22%3A0%2C%22secret%22%3A%223chidden%22%2C%22base_domain%22%3A%22mydomain.com%22%2C%22access_token%22%3A%22171372936213670|95da8e65851d8ec74c381171-650901429|x_1y78ix4VU8Wr9qytDqV-DWBk0%22%2C%22sig%22%3A%22708bf3fd1703e4c368afe22fc70ed08c%22} On my .htaccess are the following lines: RewriteCond
I am trying to reach the following result here I know how to configure
Will the following code result in a deadlock using C# on .NET? class MyClass
I was making the following call: result = RegOpenKeyEx(key, s, 0, KEY_READ, &key); (C++,
I have following html: <html ><body >Body text <div >div content</div></body></html> How could I
I'm using the a wrapper around the PHP5-class DOMDocument to generate my HTML. This
Notice the following result when I submit blank :title and :description fields Error div
For following HTML, I want to parse it and get following result using Nokogiri.
I would like to iterate. @some_value outputs the following result: { Meta => {
currently i obtain the below result from the following C# line of code when

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.