Foren

HTML parsing for JournalServiceLocalServiceUtil.addArticle()

thumbnail
Manish Yadav, geändert vor 11 Jahren.

HTML parsing for JournalServiceLocalServiceUtil.addArticle()

Expert Beiträge: 493 Beitrittsdatum: 26.05.12 Neueste Beiträge
Hi All,


I'm Working on programtically adding article form existing site db. Existing site db have one CLOB column name content which contains html code.

HTml code contains some special character . As of now i'm parsing only " charter with espace character \ . Is any other way to parse complete HTML code for java vairable as a String.

My requirement to pull HTML code from db and add article programtically in liferay db

below is my code

String contentPost="<ol><li><b style="\&quot;mso-bidi-font-weight:" normal\"><a href="\&quot;javascript:setValues_id('0,1,20,117,932');submitpage('frmViewSection','viewsection')\&quot;"><font size="\&quot;2\&quot;">SBI NEW CAR LOAN SCHEME</font></a></b></li><b style="\&quot;mso-bidi-font-weight:" normal\"><br><br><li><a href="\&quot;javascript:setValues_id('0,1,20,117,844');submitpage('frmViewSection','viewsection')\&quot;"><font size="\&quot;2\&quot;">CERTIFIED PRE-OWNED CAR LOAN</font></a></li><br><br><li><a href="\&quot;javascript:setValues_id('0,1,20,117,845');submitpage('frmViewSection','viewsection')\&quot;"><font size="\&quot;2\&quot;">CAR LOAN SCHEME FOR USED CAR</font></a></li><br><br><li><a href="\&quot;javascript:setValues_id('0,1,20,117,846');submitpage('frmViewSection','viewsection')\&quot;"><font size="\&quot;2\&quot;">2-WHEELER LOAN</font></a></li><br><br><li><a href="\&quot;javascript:setValues_id('0,1,20,117,857');submitpage('frmViewSection','viewsection')\&quot;"><font size="\&quot;2\&quot;">MOST IMPORTANT TERMS AND CODITIONS</font></a></li><br><br><li><a target="\&quot;_blank\&quot;" href="\&quot;http://www.sbi.co.in/webfiles/uploads/files/1327494947535_CAR_LOAN_APPLICATION_FORM.pdf\&quot;"><font size="\&quot;2\&quot;">CAR LOAN APPLICATION FORM</font></a></li><br><br><li><a target="\&quot;_blank\&quot;" href="\&quot;http://www.sbi.co.in/webfiles/uploads/files/1327494947535_DOCUMENT_CHECK_LIST.pdf\&quot;"><font size="\&quot;2\&quot;">CAR LOAN DOCUMENTS CHECK-LIST</font></a></li><br><br></b></ol>";
String contentPre = "<!--?xml version=\"1.0\" encoding='UTF-8' ?--><root available-locales="\&quot;en_US\&quot;" default-locale="\&quot;en_US\&quot;"><static-content language-id="\&quot;en_US\&quot;">&lt;b&gt;"+contentPost+"&lt;/b&gt;</static-content></root>";
JournalArticleLocalServiceUtil.addArticle
	(userId, groupId, 0, 0, articleId, true, version, titleMap,
	descriptionMap, contentPre,"news", structureId, templateId,"", date.getMonth(),date.getDate(), date.getYear(), date.getHours(),date.getMinutes(), 0, 0, 0, 0, 0, true, 0, 0, 0, 0, 0,true, true, false, "", smallImageFile, images, "",
	serviceContext);