I would like to generate XACML 2.0 policies programmatically. Is there a way to either do that or convert a group of XACML 3.0 policies into XACML 2.0 policies?
Thanks
Yes and yes.
First of all, can you generate XACML 2.0 policies programmatically? Yes, you can. The same applies to XACML 3.0 or any schema-based XML content. The way to do that in Java is to use JAXB.
JAXB will take an XML Schema that you write and create a set of classes that correspond to that schema. The JAXB utilities will create the hierarchy of data structures for manipulating that XML. (quoting from What is JAXB and why would I use it?).
Just give JAXB the XACML 2.0 and XACML 3.0 schemas and you will get a set of classes you can use to programmatically create XACML policies, requests, and responses.
With respect to converting though, there are a few possible approaches:
HTH, David.