tags:

views:

41

answers:

3

can i use xpath to set element properties ?

/html/body/form[@id='search']/select[@name='category' and @value='apple' and @type='select-one']
+1  A: 

No, XPath is just to query XML documents

Rubens Farias
is the above xpath valid at least for querying the element ?
asdfasdfj
sure, if you have an XML document like <html><body><form><select name='category' value='apple' type='select-one'>...</select></form></body><html>
Rubens Farias
important to note: you really needs to have a xml file like that; you can't use XPath to look into your HTML element proprieties, ok?
Rubens Farias
+1  A: 

No, but once you find the element you're looking for, you can set its properties by other means.

Anthony Mills
+2  A: 

XPath, the XML Path Language, is a query language for selecting nodes from an XML document.

To set the value you can use something like a DOM parser and setAttribute('value', 'foo');

It might help if you actually told us if that returned anything or not. You can use count() to see if it returns anything, if not noticeable.

meder