6

Possible Duplicate:
How do I select multiple sets of attributes within an XML document using XPath?

My HTML code:

<table width="100%" cellpadding="6" cellspacing="0">

i want to select this table by specifying not only the width but also with cellpadding and cellspacing..

I am using this PHP code:

$query = $xpath->query('//table[@width|@cellpadding|@cellspacing]');

but it still displays the whole html source instead of what i want..
help me please..

Community
  • 1
  • 1
Vainglory07
  • 5,073
  • 10
  • 43
  • 77
  • actually i saw it already but it does not qork on my case..maybe i dont know how to make it in html..im new to use xpath..i need help:| thanks for response – Vainglory07 Dec 18 '12 at 06:57

1 Answers1

10

It seems like you do not want to select the attributes, but check if all of the attributes are there. I.e.:

    $query = $xpath->query('//table[@width and @cellpadding and @cellspacing]');

Or if you want specifically the table, check the attributes for certain values?

    $query = $xpath->query('//table[@width = "100%" and @cellpadding = "6" and @cellspacing = "0"]');
BeniBela
  • 16,412
  • 4
  • 45
  • 52