I want to parse xml file in spring project. Can anyone provide direction for this?
This xml file will be used to load various fields which are required to be validated for each jsf page.
I want to use this xml to be read through document build factory or any generic function present in the spring
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
I want to validate a page for specific values which are defined in this xml. So I need to parse this xml file as we do in simple java program using DocumentBuilderFactory
The question is much too vague, many different scenarios are possible.
However, I thing you should take a look at the Chapter 14. Marshalling XML using O/X Mappers from the Spring reference. Perhaps you will find the answer there.
Ah, more info in the Question. So the XML contains properties, although it is not in the Java properties XML format.
OK, then I guess I’d write a BeanPostProcessor that uses Commons / Config under the hood to read the properties from XML. You should probably copy what the PropertyPlaceholderConfigurer does, to a certain extent.