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

  • Home
  • SEARCH
  • 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 8823261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:18:33+00:00 2026-06-14T06:18:33+00:00

Using Zend Dom Query I would like to search HTML to find certain attributes.

  • 0

Using Zend Dom Query I would like to search HTML to find certain attributes.

Take the following image as an example.

<img id="active-main-image"  src="/images/example.jpg" alt="Image 1234" class="product-image">

Instead of using $this->_xhtml->query('img#active-main-image'); I would like to find the image by using the alt attribute.

Pseudo -> $this->_xhtml->query('img alt Image 1234');

I can see why this method is not conventionally popular however, when equipped with nothing but the Alt value of a certain image on a page, I see no alternative.

Thanks

  • 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-06-14T06:18:34+00:00Added an answer on June 14, 2026 at 6:18 am

    Zend_Dom_Query has a queryXpath method that will accept valid xpath queries.

    Untested but this should work :

    $dom = new Zend_Dom_Query($html);
    $img = $dom->queryXpath("//img[@alt='Image 1234']");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PHP/Zend to load html into a DOM, and then I get a
I am using Zend Dom component to parse some Html blocks, but i have
Using Zend_Dom_Query, I would like to retrieve meta data out of an HTML string.
Using Zend Lucene I cannot search numbers in description fields Added it like this:
Using Zend form how would I make a control (element) an array? An example
I've been using Zend and need a search. The Zend docs aren't great so
Using Zend_Form, how would I create form elements like this <input type=text name=element[1] value=/>
I'm using Zend_DOM_Query to read HTML elements using DOM. <input type=text class=a> <input type=text
Using Zend, I want to create a navigation like: <ul class=navigation> <li> <a href=/coupon/index/all></a>
I'm using Zend Server CE 5.6.0 on Mac OSX. My httpd.conf has the following

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.