parentElement.addChild(child);
} else {
firstChildElem.insertSiblingBefore(child);
}
PolicyRegistry reg = new PolicyRegistryImpl();
String key = ((PolicyReference)policyElement).getURI();
if (key.startsWith("#")) {
key = key.substring(key.indexOf("#") + 1);
}
Policy p = reg.lookup(key);
if (p == null) {
throw new Exception("Policy not found for uri : " + key);
}