|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Describes the API to access the values of a XML content document.
Method Summary | |
void |
addLocale(CmsObject cms,
java.util.Locale locale)
Adds the given locale to this XML document. |
void |
copyLocale(java.util.Locale source,
java.util.Locale destination)
Copies the content of the given source locale to the given destination locale in this XML document. |
CmsXmlContentDefinition |
getContentDefinition()
Returns the content definition object for this xml content object. |
java.lang.String |
getConversion()
Returns the content conversion parameter used for this XML document. |
java.lang.String |
getEncoding()
Returns the encoding used for this XML document. |
CmsFile |
getFile()
Returns the file this document was generated from, may be null if the file not available. |
int |
getIndexCount(java.lang.String name,
java.util.Locale locale)
Returns the index count of existing values for the given key name, or -1 if no such value exists. |
CmsLinkProcessor |
getLinkProcessor(CmsObject cms,
CmsLinkTable linkTable)
Returns a link processor for the values of this XML document. |
java.util.List |
getLocales()
Returns a List of all locales that have at last one element in this XML document. |
java.util.List |
getLocales(java.lang.String element)
Returns a List of all locales that have the given element set in this XML document. |
java.util.List |
getNames(java.util.Locale locale)
Returns all available elements names used in this document for the given locale. |
java.lang.String |
getStringValue(CmsObject cms,
java.lang.String name,
java.util.Locale locale)
Returns the first content value for the given key name as a String, or null if no such value exists. |
java.lang.String |
getStringValue(CmsObject cms,
java.lang.String name,
java.util.Locale locale,
int index)
Returns the content value for the given key name from the selected index as a String, or null if no such value exists. |
I_CmsXmlContentValue |
getValue(java.lang.String name,
java.util.Locale locale)
Returns the content value Object for the given key name, or null if no such value exists. |
I_CmsXmlContentValue |
getValue(java.lang.String name,
java.util.Locale locale,
int index)
Returns the content value Object for the given key name from the selected index, or null if no such value exists. |
java.util.List |
getValues(java.util.Locale locale)
Returns all available elements values used in this document for the given locale. |
java.util.List |
getValues(java.lang.String name,
java.util.Locale locale)
Returns all content value Objects for the given key name in a List, or null if no such value exists. |
boolean |
hasLocale(java.util.Locale locale)
Checks if the given locale exists in this XML document. |
boolean |
hasValue(java.lang.String name,
java.util.Locale locale)
Returns true if a value exists with the given key name,
false otherwise. |
boolean |
hasValue(java.lang.String name,
java.util.Locale locale,
int index)
Returns true if a value exists with the given key name at the selected index,
false otherwise. |
void |
initDocument()
Initializes this XML document, required after structural changes to the XML. |
boolean |
isEnabled(java.lang.String name,
java.util.Locale locale)
Returns true if a value exists with the given key name,
and that value is enabled,
false otherwise. |
boolean |
isEnabled(java.lang.String name,
java.util.Locale locale,
int index)
Returns true if a value exists with the given key name at the selected index,
and that value is enabled,
false otherwise. |
void |
moveLocale(java.util.Locale source,
java.util.Locale destination)
Moves the content of the given source locale to the given destination locale in this XML document. |
void |
removeLocale(java.util.Locale locale)
Removes the given locale from this XML document. |
CmsXmlContentErrorHandler |
validate(CmsObject cms)
Validates the content of this XML document. |
Method Detail |
public void addLocale(CmsObject cms, java.util.Locale locale) throws CmsXmlException
cms
- the current users OpenCms contextlocale
- the locale to add
CmsXmlException
- in case the locale already existed, or if something else goes wrongpublic void copyLocale(java.util.Locale source, java.util.Locale destination) throws CmsXmlException
source
- the source localedestination
- the destination locale
CmsXmlException
- in case either the source locale did not exist, or the destination locale already exists in the document, or if something else goes wrongpublic CmsXmlContentDefinition getContentDefinition()
public java.lang.String getConversion()
public java.lang.String getEncoding()
public CmsFile getFile()
null
if the file not available.The file may not be available if the document was generated by a String or a pure XML document.
public int getIndexCount(java.lang.String name, java.util.Locale locale)
-1
if no such value exists.
name
- the key to get the index count forlocale
- the locale to get the index count for
public CmsLinkProcessor getLinkProcessor(CmsObject cms, CmsLinkTable linkTable)
cms
- the current OpenCms user context that provides access to the link processorlinkTable
- the table with the links to process
public java.util.List getLocales()
public java.util.List getLocales(java.lang.String element)
If no locale for the given element name is available, an empty list is returned.
element
- the element to look up the locale List for
public java.util.List getNames(java.util.Locale locale)
If no element for the given locale is available, an empty list is returned.
locale
- the locale
getValues(Locale)
public java.lang.String getStringValue(CmsObject cms, java.lang.String name, java.util.Locale locale) throws CmsXmlException
null
if no such value exists..
cms
- the current OpenCms user contextname
- the key to get the content value forlocale
- the locale to get the content value for
CmsXmlException
- if something goes wrongpublic java.lang.String getStringValue(CmsObject cms, java.lang.String name, java.util.Locale locale, int index) throws CmsXmlException
null
if no such value exists.
cms
- the current OpenCms user contextname
- the key to get the content value forlocale
- the locale to get the content value forindex
- the index position to get the value from
CmsXmlException
- if something goes wrongpublic I_CmsXmlContentValue getValue(java.lang.String name, java.util.Locale locale)
null
if no such value exists..
You can provide an index for the value by appending a numer in aquare brackets to the name parameter like this "Title[1]". If no index is provided, 0 is used for the index position.
name
- the key to get the content value forlocale
- the locale to get the content value for
public I_CmsXmlContentValue getValue(java.lang.String name, java.util.Locale locale, int index)
null
if no such value exists.
name
- the key to get the content value forlocale
- the locale to get the content value forindex
- the index position to get the value from
public java.util.List getValues(java.util.Locale locale)
If no element for the given locale is available, an empty list is returned.
locale
- the locale
I_CmsXmlContentValue
)getNames(Locale)
public java.util.List getValues(java.lang.String name, java.util.Locale locale)
null
if no such value exists.
name
- the key to get the content values forlocale
- the locale to get the content values for
public boolean hasLocale(java.util.Locale locale)
locale
- the locale to check
public boolean hasValue(java.lang.String name, java.util.Locale locale)
true
if a value exists with the given key name,
false
otherwise.You can provide an index for the value by appending a numer in aquare brackets to the name parameter like this "Title[1]". If no index is provided, 0 is used for the index position.
name
- the key to checklocale
- the locale to check
public boolean hasValue(java.lang.String name, java.util.Locale locale, int index)
true
if a value exists with the given key name at the selected index,
false
otherwise.
name
- the key to checklocale
- the locale to checkindex
- the index position to check
public void initDocument()
If nodes in the XML are added, removed or moved, the document needs to be initialized in order to update the internal data structures.
public boolean isEnabled(java.lang.String name, java.util.Locale locale)
true
if a value exists with the given key name,
and that value is enabled,
false
otherwise.You can provide an index for the value by appending a numer in aquare brackets to the name parameter like this "Title[1]". If no index is provided, 0 is used for the index position.
name
- the key to checklocale
- the locale to check
public boolean isEnabled(java.lang.String name, java.util.Locale locale, int index)
true
if a value exists with the given key name at the selected index,
and that value is enabled,
false
otherwise.
name
- the key to checklocale
- the locale to checkindex
- the index position to check
public void moveLocale(java.util.Locale source, java.util.Locale destination) throws CmsXmlException
source
- the source localedestination
- the destination locale
CmsXmlException
- in case either the source locale did not exist, or the destination locale already exists in the document, or if something else goes wrongpublic void removeLocale(java.util.Locale locale) throws CmsXmlException
locale
- the locale to remove
CmsXmlException
- in case the locale did not exist in the document, or if something else goes wrongpublic CmsXmlContentErrorHandler validate(CmsObject cms)
cms
- the current OpenCms user context
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |