[opencms-dev] Slow getStringValue - CmsXmlContent

Michael Emmerich m.emmerich at alkacon.com
Wed Nov 3 10:30:01 CET 2010


Juan,

its no good idea to read a lot of xmlcontent files, unmarshal them and 
display some of its values in a list.

A better solution would be:

Those values that should be shown in the list of xmlcontent must be 
mapped to properties in the xsd.

You then can just loop over your resources, read the map of all 
properties and display the correct ones.
This is MUCH faster than opening all the xmlcontents and reading the 
values form there.

Kind regards,
Michael




Am 03.11.2010 10:22, schrieb Juan Antonio Ruiz:
> Hi,
>
> I have a big problem. My resources list is very large (around 1000).
> When I get a value with getStringValue, it is very much slow (around 15
> millesec. per resource ). Total is 15 seconds. It is my code:
>
> for (int i = 0; i<  list.size(); i++) {
>
>>
> CmsFile file = cmsObj.readFile(resource);
>
> CmsXmlContent content = CmsXmlContentFactory.unmarshal(cmsObj, file);
>
> String name = content.getStringValue(cmsObj,"Name[1]", locale);
>
> String album = content.getStringValue(cmsObj,"Album[1]", locale);
>
> String group = content.getStringValue(cmsObj,"Group[1]", locale)
>
>>
> }
>
> Is there another way?
>
> Thanks.
>
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev

-- 
Kind Regards,
Michael.

-------------------
Michael Emmerich

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org




More information about the opencms-dev mailing list