[opencms-dev] reading xml content using CmsObject

Nigel Kersten nigel at cofa.unsw.edu.au
Wed Mar 22 10:47:08 CET 2006


On 22/03/2006, at 8:37 PM, azul z wrote:

> hi list,
>
> i want to define this method:
>
>     private void init(CmsResource resource, CmsObject cms) {
>        // resource is type xmlcontent (defined by my own xsd)
>
>        // Owner is a field defined in the xmlcontent
>        String owner = "";
>
>     }
>
>
> how can i obtain owner field from my xmlcontent file (resource)  
> using CmsObject?
> how can i obtain owner field inside that method?


In your case it should be something like:

CmsXmlContent myXmlContent = CmsXmlContentFactory.unmarshal(cms,  
resource, request);
String owner = myXmlContent.getStringValue(cms, "/Owner", locale);

where locale is your locale.

-- 
Nigel Kersten [Senior Technical Officer]
College of Fine Arts, University of NSW, Australia.
CRICOS Provider Code: 00098G






More information about the opencms-dev mailing list