Get Web Content/Journal Article Fields Data Programmatically using SAX Parser


We already see in my previous blog on  Structues and Tempelates  that Liferay Stores Structues in xml format. So if you create a Web Content using Structures and Template and want to get the value of fields programmatically , than you can use SAXReaderUtil Class of Liferay. This class is used to parse xml content.


Ex- I already Created a Structure MOBILE_STRUCTURE which contain 5 fields Brand,Model,Description,Camera and Price.Now i create web contents Sony Xperia C using this structures .This data is save in journalarticle table as:-



Here the Content column store the data in xml as:-


So What if we want to fetch the fields like Price of Sony Xperia C programmatically. Just use  SAXReaderUtil as:-





For getting JournalArticle object you may refer my previous blog on Fetch Web Content Programmatically.

Hope this will Help....

Related Post:-