Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Manish Yadav
HTML parsing for JournalServiceLocalServiceUtil.addArticle()
February 11, 2013 6:34 AM
Answer

Manish Yadav

Rank: Expert

Posts: 390

Join Date: May 26, 2012

Recent Posts

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
1
2String contentPost="<ol><li><b style=\"mso-bidi-font-weight: normal\"><a href=\"javascript:setValues_id('0,1,20,117,932');submitpage('frmViewSection','viewsection')\"><font size=\"2\">SBI NEW CAR LOAN SCHEME</font></a></b></li><b style=\"mso-bidi-font-weight: normal\"><br><br><li><a href=\"javascript:setValues_id('0,1,20,117,844');submitpage('frmViewSection','viewsection')\"><font size=\"2\">CERTIFIED PRE-OWNED CAR LOAN</font></a></li><br><br><li><a href=\"javascript:setValues_id('0,1,20,117,845');submitpage('frmViewSection','viewsection')\"><font size=\"2\">CAR LOAN SCHEME FOR USED CAR</font></a></li><br><br><li><a href=\"javascript:setValues_id('0,1,20,117,846');submitpage('frmViewSection','viewsection')\"><font size=\"2\">2-WHEELER LOAN</font></a></li><br><br><li><a href=\"javascript:setValues_id('0,1,20,117,857');submitpage('frmViewSection','viewsection')\"><font size=\"2\">MOST IMPORTANT TERMS AND CODITIONS</font></a></li><br><br><li><a target=\"_blank\" href=\"http://www.sbi.co.in/webfiles/uploads/files/1327494947535_CAR_LOAN_APPLICATION_FORM.pdf\"><font size=\"2\">CAR LOAN APPLICATION FORM</font></a></li><br><br><li><a target=\"_blank\" href=\"http://www.sbi.co.in/webfiles/uploads/files/1327494947535_DOCUMENT_CHECK_LIST.pdf\"><font size=\"2\">CAR LOAN DOCUMENTS CHECK-LIST</font></a></li><br><br></b></ol>";
3String contentPre = "<?xml version=\"1.0\" encoding='UTF-8' ?><root available-locales=\"en_US\" default-locale=\"en_US\"><static-content language-id=\"en_US\"><![CDATA[<b>"+contentPost+"</b>]]></static-content></root>";
4JournalArticleLocalServiceUtil.addArticle
5    (userId, groupId, 0, 0, articleId, true, version, titleMap,
6    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, "",
7    serviceContext);