I am using liferay technology and trying to retrieve data from xml file in portlet dynamically by using SAXBuilder but it is not working. If you have any idea then please let me know.
我正在使用liferay技术,并试图通过使用SAXBuilder动态地从portlet中的xml文件中检索数据,但它不起作用。如果你有什么想法,请告诉我。
1 个解决方案
#1
0
use dom4j library
使用dom4j库
InputStream is = new FileInputStream(filePath);
SAXReader reader = new SAXReader();
org.dom4j.Document doc = reader.read(is);
is.close();
Element content = doc.getRootElement(); //this will return the root element in your xml file
List<Element> methodEls = content.elements("element"); // this will retun List of all Elements with name "element"
#1
0
use dom4j library
使用dom4j库
InputStream is = new FileInputStream(filePath);
SAXReader reader = new SAXReader();
org.dom4j.Document doc = reader.read(is);
is.close();
Element content = doc.getRootElement(); //this will return the root element in your xml file
List<Element> methodEls = content.elements("element"); // this will retun List of all Elements with name "element"