/** * @see org.opencms.loader.A_CmsXmlDocumentLoader#unmarshalXmlDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest) */ @Override protected I_CmsXmlDocument unmarshalXmlDocument(CmsObject cms, CmsResource resource, ServletRequest req) throws CmsException { return CmsXmlContentFactory.unmarshal(cms, resource, req); }
/** * Creates a new XML content based on a resource type.<p> * * @param cms the current OpenCms context * @param locale the locale to generate the default content for * @param resourceType the resource type for which the document should be created * * @return the created XML content * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent createDocument(CmsObject cms, Locale locale, CmsResourceTypeXmlContent resourceType) throws CmsXmlException { String schema = resourceType.getSchema(); CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema); CmsXmlContent xmlContent = CmsXmlContentFactory.createDocument( cms, locale, OpenCms.getSystemInfo().getDefaultEncoding(), contentDefinition); return xmlContent; }
content = CmsXmlContentFactory.createDocument( cms, locale,
/** * @see org.opencms.loader.A_CmsXmlDocumentLoader#unmarshalXmlDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest) */ @Override protected I_CmsXmlDocument unmarshalXmlDocument(CmsObject cms, CmsResource resource, ServletRequest req) throws CmsException { return CmsXmlContentFactory.unmarshal(cms, resource, req); }
/** * @see org.opencms.loader.A_CmsXmlDocumentLoader#unmarshalXmlDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest) */ @Override protected I_CmsXmlDocument unmarshalXmlDocument(CmsObject cms, CmsResource resource, ServletRequest req) throws CmsException { return CmsXmlContentFactory.unmarshal(cms, resource, req); }
/** * Factory method to unmarshal (read) a XML content instance from a OpenCms VFS file * that contains XML data.<p> * * <b>Warning:</b><br/> * This method does not support requested historic versions, it always loads the * most recent version. Use <code>{@link #unmarshal(CmsObject, CmsResource, ServletRequest)}</code> * for history support.<p> * * @param cms the current cms object * @param file the file with the XML data to unmarshal * * @return a XML page instance unmarshalled from the provided file * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent unmarshal(CmsObject cms, CmsFile file) throws CmsXmlException { return unmarshal(cms, file, true); }
/** * Factory method to unmarshal (read) a XML content instance from a OpenCms VFS file * that contains XML data.<p> * * <b>Warning:</b><br/> * This method does not support requested historic versions, it always loads the * most recent version. Use <code>{@link #unmarshal(CmsObject, CmsResource, ServletRequest)}</code> * for history support.<p> * * @param cms the current cms object * @param file the file with the XML data to unmarshal * * @return a XML page instance unmarshalled from the provided file * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent unmarshal(CmsObject cms, CmsFile file) throws CmsXmlException { return unmarshal(cms, file, true); }
/** * Factory method to unmarshal (generate) a XML content instance from a String * that contains XML data.<p> * * The given encoding is used when marshalling the XML again later.<p> * * Since no {@link CmsObject} is available, no link validation is performed!<p> * * <b>Warning:</b><br/> * This method does not support requested historic versions, it always loads the * most recent version. Use <code>{@link #unmarshal(CmsObject, CmsResource, ServletRequest)}</code> * for history support.<p> * * @param xmlData the XML data in a String * @param encoding the encoding to use when marshalling the XML content later * @param resolver the XML entity resolver to use * * @return a XML content instance unmarshalled from the String * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent unmarshal(String xmlData, String encoding, EntityResolver resolver) throws CmsXmlException { return unmarshal(null, xmlData, encoding, resolver); } }
/** * Factory method to unmarshal (generate) a XML content instance from a String * that contains XML data.<p> * * The given encoding is used when marshalling the XML again later.<p> * * Since no {@link CmsObject} is available, no link validation is performed!<p> * * <b>Warning:</b><br/> * This method does not support requested historic versions, it always loads the * most recent version. Use <code>{@link #unmarshal(CmsObject, CmsResource, ServletRequest)}</code> * for history support.<p> * * @param xmlData the XML data in a String * @param encoding the encoding to use when marshalling the XML content later * @param resolver the XML entity resolver to use * * @return a XML content instance unmarshalled from the String * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent unmarshal(String xmlData, String encoding, EntityResolver resolver) throws CmsXmlException { return unmarshal(null, xmlData, encoding, resolver); } }
/** * Unmarshalls the content of the encapsulated CmsResource and stores it within the * CmsContentCheckResource. If the xmlcontent is already existing, it is not unmarshalled * again.<p> * * @param cms the CmsObject * @throws CmsException if loading of the content fails */ public void upgradeXmlContent(CmsObject cms) throws CmsException { if (m_xmlcontent == null) { CmsFile file = cms.readFile(m_resource); m_xmlcontent = CmsXmlContentFactory.unmarshal(cms, file); } } }
/** * Helper method for loading the XML content from the configuration file.<p> * * @return the parsed XML document * * @throws CmsException if something goes wrong */ private I_CmsXmlDocument getDocument() throws CmsException { if (m_document == null) { m_file = m_cms.readFile(m_resource); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, m_file); m_document = content; } return m_document; }
/** * Unmarshals the XML content and adds the file to the bundle files. * @throws CmsException thrown if reading the file or unmarshaling fails. */ private void initXmlBundle() throws CmsException { CmsFile file = m_cms.readFile(m_resource); m_bundleFiles.put(null, m_resource); m_xmlBundle = CmsXmlContentFactory.unmarshal(m_cms, file); initKeySetForXmlBundle(); }
/** * Factory method to unmarshal (generate) a XML content instance from a String * that contains XML data.<p> * * The given encoding is used when marshalling the XML again later.<p> * * <b>Warning:</b><br/> * This method does not support requested historic versions, it always loads the * most recent version. Use <code>{@link #unmarshal(CmsObject, CmsResource, ServletRequest)}</code> * for history support.<p> * * @param cms the cms context, if <code>null</code> no link validation is performed * @param xmlData the XML data in a String * @param encoding the encoding to use when marshalling the XML content later * @param resolver the XML entitiy resolver to use * * @return a XML content instance unmarshalled from the String * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent unmarshal(CmsObject cms, String xmlData, String encoding, EntityResolver resolver) throws CmsXmlException { // create the XML content object from the provided String return unmarshal(cms, CmsXmlUtils.unmarshalHelper(xmlData, resolver), encoding, resolver); }
/** * Factory method to unmarshal (generate) a XML content instance from a byte array * that contains XML data.<p> * * When unmarshalling, the encoding is read directly from the XML header of the byte array. * The given encoding is used only when marshalling the XML again later.<p> * * <b>Warning:</b><br/> * This method does not support requested historic versions, it always loads the * most recent version. Use <code>{@link #unmarshal(CmsObject, CmsResource, ServletRequest)}</code> * for history support.<p> * * @param cms the cms context * @param xmlData the XML data in a byte array * @param encoding the encoding to use when marshalling the XML content later * @param resolver the XML entitiy resolver to use * * @return a XML content instance unmarshalled from the byte array * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent unmarshal(CmsObject cms, byte[] xmlData, String encoding, EntityResolver resolver) throws CmsXmlException { return unmarshal(cms, CmsXmlUtils.unmarshalHelper(xmlData, resolver), encoding, resolver); }
/** * Factory method to unmarshal (generate) a XML content instance from a byte array * that contains XML data.<p> * * When unmarshalling, the encoding is read directly from the XML header of the byte array. * The given encoding is used only when marshalling the XML again later.<p> * * <b>Warning:</b><br/> * This method does not support requested historic versions, it always loads the * most recent version. Use <code>{@link #unmarshal(CmsObject, CmsResource, ServletRequest)}</code> * for history support.<p> * * @param cms the cms context * @param xmlData the XML data in a byte array * @param encoding the encoding to use when marshalling the XML content later * @param resolver the XML entitiy resolver to use * * @return a XML content instance unmarshalled from the byte array * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent unmarshal(CmsObject cms, byte[] xmlData, String encoding, EntityResolver resolver) throws CmsXmlException { return unmarshal(cms, CmsXmlUtils.unmarshalHelper(xmlData, resolver), encoding, resolver); }
/** * Factory method to unmarshal (generate) a XML content instance from a String * that contains XML data.<p> * * The given encoding is used when marshalling the XML again later.<p> * * <b>Warning:</b><br/> * This method does not support requested historic versions, it always loads the * most recent version. Use <code>{@link #unmarshal(CmsObject, CmsResource, ServletRequest)}</code> * for history support.<p> * * @param cms the cms context, if <code>null</code> no link validation is performed * @param xmlData the XML data in a String * @param encoding the encoding to use when marshalling the XML content later * @param resolver the XML entitiy resolver to use * * @return a XML content instance unmarshalled from the String * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContent unmarshal(CmsObject cms, String xmlData, String encoding, EntityResolver resolver) throws CmsXmlException { // create the XML content object from the provided String return unmarshal(cms, CmsXmlUtils.unmarshalHelper(xmlData, resolver), encoding, resolver); }
/** * Unmarshal the XML content with auto-correction. * @param file the file that contains the XML * @return the XML read from the file * @throws CmsXmlException thrown if the XML can't be read. */ private CmsXmlContent unmarshalXmlContent(CmsFile file) throws CmsXmlException { CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file); content.setAutoCorrectionEnabled(true); content.correctXmlStructure(m_cms); return content; }
/** * Parses a given resource.<p> * * @param resource the resource to parse * * @throws CmsException if something goes wrong */ public void parse(CmsResource resource) throws CmsException { CmsFile file = m_cms.readFile(resource); m_resource = resource; CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file); parse(content); }
/** * Parses a dynamic function bean given a resource.<p> * * @param cms the current CMS context * @param res the resource from which to read the dynamic function * * @return the dynamic function bean created from the resource * * @throws CmsException if something goes wrong */ public CmsDynamicFunctionBean parseFunctionBean(CmsObject cms, CmsResource res) throws CmsException { CmsFile file = cms.readFile(res); CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(cms, file); return parseFunctionBean(cms, xmlContent); }
/** * Parses the sitemap configuration given the configuration file and base path.<p> * * @param basePath the base path * @param configRes the configuration file resource * @return the parsed configuration data * @throws CmsException if something goes wrong */ public CmsADEConfigDataInternal parseSitemapConfiguration(String basePath, CmsResource configRes) throws CmsException { LOG.info("Parsing configuration " + configRes.getRootPath()); CmsFile configFile = m_cms.readFile(configRes); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, configFile); return parseConfiguration(basePath, content); }