tags:

views:

36

answers:

2

From the html source file i've to identify tag with inline style attribute using java.

For example

<span id="abc" 
 style="font-size:11.0pt;font-family:'arial black','sans-serif'; color:#5f497a">

Please help

+1  A: 

Using a regex is one way to do it, eg.

/<span[^>]*style=.*?>/

Or alternatively, if the HTML is well formed, load it using a parser and then use an XPath.

//span[@style]
ar
not only for span tag style attribute may present in any block elements
Sathish
+2  A: 

http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html

Do not parse HTML with regex. Use a proper HTML parser (there are tons out there for Java), and extract the desired data from the DOM tree.

Yorirou