|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.xml.content.CmsXmlContentFactory
public final class CmsXmlContentFactory
Provides factory methods to unmarshal (read) an XML content object.
Method Summary | |
---|---|
static CmsXmlContent |
createDocument(CmsObject cms,
java.util.Locale locale,
java.lang.String modelUri)
Create a new instance of an XML content based on the given default content, hat will have all language nodes of the default content and ensures the presence of the given locale. |
static CmsXmlContent |
createDocument(CmsObject cms,
java.util.Locale locale,
java.lang.String encoding,
CmsXmlContentDefinition contentDefinition)
Create a new instance of an XML content based on the given content definiton, that will have one language node for the given locale all initialized with default values. |
static CmsXmlContent |
unmarshal(CmsObject cms,
byte[] xmlData,
java.lang.String encoding,
org.xml.sax.EntityResolver resolver)
Factory method to unmarshal (generate) a XML content instance from a byte array that contains XML data. |
static CmsXmlContent |
unmarshal(CmsObject cms,
CmsFile file)
Factory method to unmarshal (read) a XML content instance from a OpenCms VFS file that contains XML data. |
static CmsXmlContent |
unmarshal(CmsObject cms,
CmsFile file,
boolean keepEncoding)
Factory method to unmarshal (read) a XML content instance from a OpenCms VFS file that contains XML data, using wither the encoding set in the XML file header, or the encoding set in the VFS file property. |
static CmsXmlContent |
unmarshal(CmsObject cms,
CmsResource resource,
javax.servlet.ServletRequest req)
Factory method to unmarshal (read) a XML content instance from a resource, using the request attributes as cache. |
static CmsXmlContent |
unmarshal(CmsObject cms,
org.dom4j.Document document,
java.lang.String encoding,
org.xml.sax.EntityResolver resolver)
Factory method to unmarshal (generate) a XML content instance from a XML document. |
static CmsXmlContent |
unmarshal(CmsObject cms,
java.lang.String xmlData,
java.lang.String encoding,
org.xml.sax.EntityResolver resolver)
Factory method to unmarshal (generate) a XML content instance from a String that contains XML data. |
static CmsXmlContent |
unmarshal(java.lang.String xmlData,
java.lang.String encoding,
org.xml.sax.EntityResolver resolver)
Factory method to unmarshal (generate) a XML content instance from a String that contains XML data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static CmsXmlContent createDocument(CmsObject cms, java.util.Locale locale, java.lang.String modelUri) throws CmsException
The given encoding is used when marshalling the XML again later.
cms
- the current users OpenCms contentlocale
- the locale to generate the default content formodelUri
- the absolute path to the XML content file acting as model
CmsException
- in case the model file is not found or not validpublic static CmsXmlContent createDocument(CmsObject cms, java.util.Locale locale, java.lang.String encoding, CmsXmlContentDefinition contentDefinition)
The given encoding is used when marshalling the XML again later.
cms
- the current users OpenCms contentlocale
- the locale to generate the default content forencoding
- the encoding to use when marshalling the XML content latercontentDefinition
- the content definiton to create the content for
public static CmsXmlContent unmarshal(CmsObject cms, byte[] xmlData, java.lang.String encoding, org.xml.sax.EntityResolver resolver) throws CmsXmlException
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.
Warning:
This method does not support requested historic versions, it always loads the
most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
cms
- the cms contextxmlData
- the XML data in a byte arrayencoding
- the encoding to use when marshalling the XML content laterresolver
- the XML entitiy resolver to use
CmsXmlException
- if something goes wrongpublic static CmsXmlContent unmarshal(CmsObject cms, CmsFile file) throws CmsXmlException
Warning:
This method does not support requested historic versions, it always loads the
most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
cms
- the current cms objectfile
- the file with the XML data to unmarshal
CmsXmlException
- if something goes wrongpublic static CmsXmlContent unmarshal(CmsObject cms, CmsFile file, boolean keepEncoding) throws CmsXmlException
If you are not sure about the implications of the encoding issues,
use unmarshal(CmsObject, CmsFile)
instead.
Warning:
This method does not support requested historic versions, it always loads the
most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
cms
- the current cms objectfile
- the file with the XML data to unmarshalkeepEncoding
- if true, the encoding spefified in the XML header is used,
otherwise the encoding from the VFS file property is used
CmsXmlException
- if something goes wrongpublic static CmsXmlContent unmarshal(CmsObject cms, CmsResource resource, javax.servlet.ServletRequest req) throws CmsXmlException, CmsLoaderException, CmsException
cms
- the current OpenCms context objectresource
- the resource to unmarshalreq
- the current request
CmsResourceTypeXmlContent
CmsException
- in something goes wrong
CmsLoaderException
- if no loader for the given resource
type (CmsResource.getTypeId()
) is available
CmsXmlException
- if the given resource
is not of type xml contentpublic static CmsXmlContent unmarshal(CmsObject cms, org.dom4j.Document document, java.lang.String encoding, org.xml.sax.EntityResolver resolver)
The given encoding is used when marshalling the XML again later.
Warning:
This method does not support requested historic versions, it always loads the
most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
cms
- the cms context, if null
no link validation is performeddocument
- the XML document to generate the XML content fromencoding
- the encoding to use when marshalling the XML content laterresolver
- the XML entitiy resolver to use
public static CmsXmlContent unmarshal(CmsObject cms, java.lang.String xmlData, java.lang.String encoding, org.xml.sax.EntityResolver resolver) throws CmsXmlException
The given encoding is used when marshalling the XML again later.
Warning:
This method does not support requested historic versions, it always loads the
most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
cms
- the cms context, if null
no link validation is performedxmlData
- the XML data in a Stringencoding
- the encoding to use when marshalling the XML content laterresolver
- the XML entitiy resolver to use
CmsXmlException
- if something goes wrongpublic static CmsXmlContent unmarshal(java.lang.String xmlData, java.lang.String encoding, org.xml.sax.EntityResolver resolver) throws CmsXmlException
The given encoding is used when marshalling the XML again later.
Since no CmsObject
is available, no link validation is performed!
Warning:
This method does not support requested historic versions, it always loads the
most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
xmlData
- the XML data in a Stringencoding
- the encoding to use when marshalling the XML content laterresolver
- the XML entity resolver to use
CmsXmlException
- if something goes wrong
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |