[opencms-dev] Problem with CmsXmlPageFactory.unmarshal creating only empty pages
Eska
sven.kiesow at interone.de
Fri Feb 12 11:22:36 CET 2010
Hi Paul,
The hard thing was not to get Entries from a CmsXmlContent, but how to store
them then into
another CmsXmlContent. But thanks anyway.
Eska
Paul-Inge Flakstad wrote:
>
> Hi Eska,
>
> "xmlpage" is just the resource type for "Page with free text".
>
> I'm not totally sure (perhaps someone else can confirm or correct?) but
> this is what I think:
> 1.) CmsXmlPage is used to process resources of type "xmlpage".
> 2.) CmsXmlContent is an equivalent class, used to process structured
> content resource types ("xmlcontent").
>
> Not sure if you need any more help at this point, but just thought I'd
> mention it.
>
> A short example code snippet:
>
> <%@ page import="org.opencms.file.*,
> org.opencms.jsp.*,
> org.opencms.xml.*,
> org.opencms.xml.page.*,
> org.opencms.xml.content.*,
> org.opencms.xml.types.*,
> java.util.*" %>
> <%
> CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
> response);
> CmsObject cmso = cms.getCmsObject();
>
> String myFile = "/my/structuredcontent/file.html";
> Locale locale = new Locale("en");
>
> CmsXmlContent xmlCont = CmsXmlContentFactory.unmarshal(cmso,
> cmso.readFile(myFile));
> out.println("Locales: " + xmlCont.getLocales() + "<br />");
>
> List textElements2 = xmlCont.getNames(locale);
> Iterator j = textElements2.iterator();
> if (j.hasNext()) {
> out.println("<ul>");
> while (j.hasNext()) {
> String textElementName = (String)j.next();
> String textElement = xmlCont.getValue(textElementName,
> locale).getStringValue(cmso);
> out.println("<li>" + textElementName + " = " + textElement +
> "</li>");
> }
> out.println("</ul>");
> }
> %>
>
> Best regards,
> Paul
>
>
--
View this message in context: http://old.nabble.com/Problem-with-CmsXmlPageFactory.unmarshal-creating-only-empty-pages-tp27544324p27561465.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.
More information about the opencms-dev
mailing list