How to convert HTML using replace or remove commoand in C# or Java -
html 1 m getting in string -> s= "<html> <head> <link rel='stylesheet' type='text/css' href='http://www.taxmann.com/css/taxmannstyle.css' /> </head> <body ><html> <body style='background-color:black;font-size:30px;color:#fff;'> <div id=\"digest\">\r\n <p class=\"threedigest\">st : extended period of limitation cannot invoked not paying tax if there divergence of opinion during relevant period , judgments in favour of assessee, there no suppression/wilful mis-statement assessee</p>\r\n </div></body></html></body></html>"
note : getting html correct
but string html 2 -> "<html> <head> <link rel='stylesheet ' type='text/css' href='http://www.taxmann.com/css/taxmannstyle.css' /> </head> <body ><html><body style='background-color:black;font-size:30px;color:#fff;'> <html>\r\n<head> <link href='http://www.taxmann.com/taxmannwhatsnewservice/styles/style.css' rel='stylesheet' type='text/css' /> \r\n<title>rs.560-crore tax evasion detected</title>\r\n<style type=\"text/css\"> \r\nbody {font-family:arial, helvetica, sans-serif; font-size:12px; line-height:18px;text-align:justify;} \r\n.w100{width:100%;}\r\n.fl-l{float:left;}\r\n.ffla{font-family:arial, helvetica, sans-serif;} \r\n.fs18{font-size:18px;}\r\n.mart10{margin-top:10px;}\r\n.fcred{color:#c81616;} \r\n.tc{text-align:center;}\r\n.tu{text-transform:uppercase;}\r\n.lh18{line-height:18px;}\r\n</style>\r\n</head>\r\n<body>\r\n <div class=\"w100 fl-l\">\r\n<div class=\"w100 fl-l ffla fs18 mart10 fcred ttunderline tc tu\"> rs.560-crore tax vasion detected</div>\r\n\r\n<div class=\"w100 fl-l lh18 mart10\"> central excise intelligence, chennai zone, has detected 164 cases involving excise , service tax evasion of rs.560 crore in 2012- 13. total of 166 show cause notices have been issued involving rs.500 crore various central excise , service tax cases during year. – www.business-standard.com</div>\r\n\r\n </div>\r\n</body>\r\n </html>\r\n</body> </html></body> </html>"
i want convert html 2 format same html1 format tried unable . have tried remove html content not worked, don't know how convert html2 same html1 have tried remove using java not able please me ! using replace or remove command in programming language.
try working removing 2 unwanted html tags in line 1 in code i.e response server have 2 html tags because of not getting proper response. try remove unwanted tags , align html code
public class testscriptclass { public static void main(string[] args) { string inputvalue=" "; inputvalue =inputvalue+"<html><head> <link rel='stylesheet' type='text/css' href='http://www.taxmann.com/css/taxmannstyle.css' />"+ "</head> <body ><html><body style='background-color:black;font-size:30px;color:#fff;'>"+ "<html>\r\n<head> <link href='http://www.taxmann.com/taxmannwhatsnewservice/styles/style.css' rel='stylesheet' type='text/css' />"+ "\r\n<title>rs.560-crore tax evasion detected</title>\r\n<style type=\"text/css\">"+ " \r\nbody{font-family:arial, helvetica, sans-serif; font-size:12px; "+ " line-height:18px;text-align:justify;} \r\n.w100{width:100%;}\r\n.fl-l{float:left;}\r\n.ffla{font-family:arial, "+ "helvetica, sans-serif;} \r\n.fs18{font-size:18px;}\r\n.mart10{margin-top:10px;}\r\n.fcred{color:#c81616;}"+ " \r\n.tc{text-align:center;}\r\n.tu{text-transform:uppercase;}\r\n.lh18{line-height:18px;}\r\n</style>\r\n</head>\r\n<body>\r\n"+ " <div class=\"w100 fl-l\">\r\n<div class=\"w100 fl-l ffla fs18 mart10 fcred ttunderline tc tu\">"+ " rs.560-crore tax "+ "vasion detected</div>\r\n\r\n<div class=\"w100 fl-l lh18 mart10\">"+ " central excise intelligence, "+ "chennai zone, has detected 164 cases involving excise"+ " , service tax evasion of rs.560 crore in 2012- 13."+ " total of 166 show cause notices"+ " have been issued involving rs.500 crore "+ " various central excise , service "+ " tax cases during year."+ "– www.business-standard.com</div>\r\n\r\n"+ " </div>\r\n</body>\r\n"+ " </html>\r\n</body>"+ " </html></body>"+ " </html>"; string resultvalue= inputvalue.replace("<html><head> <link rel='stylesheet' type='text/css' href='http://www.taxmann.com/css/taxmannstyle.css' /></head> <body ><html>", " <html><head> <link rel='stylesheet' type='text/css' href='http://www.taxmann.com/css/taxmannstyle.css' />"); system.out.println(resultvalue); } }
Comments
Post a Comment