public AuthorizationInfoBean mapXMLToBean(Document doc) throws Exception { AuthorizationInfoBean infoBean = new AuthorizationInfoBean(); Element authInfoNode = doc.getRootElement(); if (DEBUG) System.out.println("ROOT----------"); // map root node attributes List rootAttributes = authInfoNode.getAttributes(); if (rootAttributes != null) { for (int i = 0; i < rootAttributes.size(); i++) { Attribute rootAtt = (Attribute) (rootAttributes.get(i)); if (DEBUG) System.out.println("mapping:" + rootAtt.getName() + " " + rootAtt.getValue()); BeanUtils.setProperty( infoBean, rootAtt.getName().substring(0, 1).toLowerCase() + rootAtt.getName().substring(1, rootAtt.getName().length()), rootAtt.getValue()); } } if (DEBUG) System.out.println("Content----------"); // map all content node's attributes Element contentNode = authInfoNode.getChild("Content"); List contentAttributes = contentNode.getAttributes(); ContentBean contentBean = new ContentBean(); if (contentAttributes != null) { for (int i = 0; i < contentAttributes.size(); i++) { Attribute contentAtt = (Attribute) (contentAttributes.get(i)); if (DEBUG) System.out.println("mapping:" + contentAtt.getName() + " " + contentAtt.getValue()); // BeanUtils.setProperty(contentBean, contentAtt.getName(), // contentAtt.getValue()); BeanUtils.setProperty( contentBean, contentAtt.getName().substring(0, 1).toLowerCase() + contentAtt.getName().substring(1, contentAtt.getName().length()), contentAtt.getValue()); } } infoBean.setContent(contentBean); if (DEBUG) System.out.println("Subpolicy----------"); // map all subpolicy node's attribtues Element subPolicyNode = authInfoNode.getChild("SubPolicy"); List subpolicyAttributes = subPolicyNode.getAttributes(); SubPolicyBean subPolicyBean = new SubPolicyBean(); if (subpolicyAttributes != null) { for (int i = 0; i < subpolicyAttributes.size(); i++) { Attribute subpolicyAtt = (Attribute) (subpolicyAttributes.get(i)); if (DEBUG) System.out.println("mapping:" + subpolicyAtt.getName() + " " + subpolicyAtt.getValue()); // BeanUtils.setProperty(subPolicyBean, subpolicyAtt.getName(), // subpolicyAtt.getValue()); BeanUtils.setProperty( subPolicyBean, subpolicyAtt.getName().substring(0, 1).toLowerCase() + subpolicyAtt.getName().substring(1, subpolicyAtt.getName().length()), subpolicyAtt.getValue()); } } infoBean.setSubpolicy(subPolicyBean); if (DEBUG) System.out.println("all mapped"); return infoBean; }