For obtaining the style of an ElementBox, you may use its getStyle() (object representation) or getStyleString() (a CSS string representation) functions. You may check the BoxBrowser.java demo that shows the details about a displayed box when you click it.
For examining the DOM tree, you may use the ElementBox getElement() function and then use standard DOM functions (e.g. getParent() etc.) Again, the BoxBrowser demo shows the DOM tree in the second tab in the left column.
I am not sure what excatly you would like to use XPath for. CSSBox does not include an XPath processor however it works with a standard DOM. That means, you may use any third-party XPath processor when necessary.
Radek
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Is it possible to get the XPath of an element from a Page? Is it supported?
Thanks,
Arjun
Or would it be possible to get the CSS Expression of the selected element?
I'm building a tool similar to firebug. I need to figure out a way to get either the XPath or the CSS Selector of the selected element.
Thanks,
Arjun
For obtaining the style of an ElementBox, you may use its getStyle() (object representation) or getStyleString() (a CSS string representation) functions. You may check the BoxBrowser.java demo that shows the details about a displayed box when you click it.
For examining the DOM tree, you may use the ElementBox getElement() function and then use standard DOM functions (e.g. getParent() etc.) Again, the BoxBrowser demo shows the DOM tree in the second tab in the left column.
I am not sure what excatly you would like to use XPath for. CSSBox does not include an XPath processor however it works with a standard DOM. That means, you may use any third-party XPath processor when necessary.
Radek