public DefaultPDPProxy(final InputStream rightsDocument) { if (rightsDocument == null) { throw new IllegalArgumentException("parameter <rightsDocument> must not null"); } m_rightsDocument = DOMParser.createNew(DOMParserOptions.getDefault().notNamespaceaware()).parse( new InputSource(rightsDocument)); }
public Document asXmlDocument(Locale userLocale) { String[] parts = getPathToXmlTree().split("\\."); StringBuilder localizedName = new StringBuilder(); localizedName.append(parts[0]); localizedName.append("_"); localizedName.append(userLocale.getLanguage()); localizedName.append("."); localizedName.append(parts[1]); Document treeDoc = DOMUtil.createDocumentFromSystemID(localizedName.toString(), DOMParserOptions.getDefault().notNamespaceaware()); if (treeDoc == null) { LOG.warn("Could not load tree: {}", localizedName.toString()); LOG.warn("Loading {} instead", getPathToXmlTree()); treeDoc = DOMUtil.createDocumentFromSystemID(getPathToXmlTree(), DOMParserOptions.getDefault().notNamespaceaware()); } return treeDoc; } }
/** * Renders the bean as XML * * @param pBean bean to render * @return document with bean values * @throws ClassNotFoundException if bean class is not found * @throws IllegalAccessException if access to bean is not allowed * @throws InstantiationException if bean instantiation breaks up */ public Document toXML(BaseBean pBean) throws ClassNotFoundException, IllegalAccessException, InstantiationException { StringBuffer lBuffer = new StringBuffer(); if (pBean instanceof MultipleElementBean) { mXStream.processAnnotations(((MultipleElementBean) pBean).getBean().getClass()); lBuffer.append("<"); lBuffer.append(mMultiElementName); lBuffer.append(">"); List<BaseBean> lList = ((MultipleElementBean) pBean).getItems(); for (BaseBean aLList : lList) { lBuffer.append(transformSingleBean(aLList)); } lBuffer.append("</"); lBuffer.append(mMultiElementName); lBuffer.append(">"); } else { mXStream.processAnnotations(pBean.getClass()); lBuffer.append(transformSingleBean(pBean)); } return DOMUtil.createFromString(lBuffer.toString(), DOMParserOptions.getDefault().notNamespaceaware()); }