[opencms-dev] Unmarshalling XML document failed
Atle Enersen
atle.enersen at gmail.com
Thu May 1 16:14:07 CEST 2025
I get his error when trying to “pull” a resource type from the wand into the pink area (see below). This is a fresh install of version 19, and all permissions (MacBook Pro M3) are set as they should be. I cannot understand this, neither figure out which file this is supposed to be…
Unmarshalling XML document failed. (systemId = null)
Reason:Error on line 1 of document : The markup in the document preceding the root element must be well-formed.
Ticket Id: 1746108131686
org.opencms.xml.CmsXmlException: Unmarshalling XML document failed. (systemId = null)
org.opencms.xml.CmsXmlUtils.unmarshalHelper(CmsXmlUtils.java:864)
org.opencms.xml.CmsXmlUtils.unmarshalHelper(CmsXmlUtils.java:819)
org.opencms.xml.CmsXmlUtils.unmarshalHelper(CmsXmlUtils.java:776)
org.opencms.xml.containerpage.CmsXmlContainerPageFactory.unmarshal(CmsXmlContainerPageFactory.java:142)
org.opencms.xml.containerpage.CmsXmlContainerPageFactory.unmarshal(CmsXmlContainerPageFactory.java:255)
org.opencms.xml.containerpage.CmsXmlContainerPageFactory.unmarshal(CmsXmlContainerPageFactory.java:191)
org.opencms.xml.containerpage.CmsXmlContainerPageFactory.unmarshal(CmsXmlContainerPageFactory.java:163)
org.opencms.ade.containerpage.CmsContainerpageService.saveContainers(CmsContainerpageService.java:3352)
org.opencms.ade.containerpage.CmsContainerpageService.saveContainerpage(CmsContainerpageService.java:2001)
jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
java.lang.reflect.Method.invoke(Method.java:580)
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:587)
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:349)
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:319)
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:389)
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
javax.servlet.http.HttpServlet.service(HttpServlet.java:555)
javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
org.opencms.gwt.CmsGwtService.service(CmsGwtService.java:215)
org.opencms.main.OpenCmsCore.invokeGwtService(OpenCmsCore.java:2164)
org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:360)
org.opencms.main.OpenCmsServlet.doPost(OpenCmsServlet.java:381)
javax.servlet.http.HttpServlet.service(HttpServlet.java:555)
javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
org.opencms.jsp.jsonpart.CmsJsonPartFilter.doFilter(CmsJsonPartFilter.java:298)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:65)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:621)
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:401)
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:340)
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:285)
org.opencms.main.OpenCmsUrlServletFilter.doFilter(OpenCmsUrlServletFilter.java:145)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:72)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:656)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:397)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:935)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1792)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1189)
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:658)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
java.lang.Thread.run(Thread.java:1575)
Here is what I am doing…:
- Create your own module like "org.enersen.core". When creating, make sure that you created the folders "formatters", "i18n", "resources", "schemas" and "templates" in it. If you have not done this when creating the nodule, simply create those folders under "/system/modules/org.enersen.core"
- Now create a template in "/system/modules/org.enersen.core/templates/": Create a new file of the type "Page template" which is found under "Configurations" in the new dialog. Name the new file "template.jsp" (or any other name you like).
- Open it for editing and paste the following in it. This is the basic skeleton for a very simple template, creating one container there you can later put in your content elements:
<%@page pageEncoding="UTF-8" buffer="none" session="false" trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"<http://java.sun.com/jsp/jstl/core> %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms"<http://www.opencms.org/taglib/cms>%>
<!DOCTYPE html>
<html>
<head>
<cms:enable-ade />
</head>
<body>
<c:if test="${cms.isEditMode}">
<div style="margin-top:60px">
</div>
</c:if>
<div>
<p>
This is above the container.
</p>
</div>
<div>
<cms:container name="main" type="content">
<div style="background-color:#F5A9A9; padding:20px">
Container: Pull content elements in here.
</div>
</cms:container>
</div>
<div>
<p>
This is below the container.
</p>
</div>
</body>
</html>
- The interesting parts are highlights in the code: <cms: enable-ade> enables the ui functions in the template, so that you can drag&drop some contents in it. <cms:container> defines the container, i.e. the placeholder where your contents can be pulled into. The "name" attribute must be unique, every container has its own name. The "type" attribute defines the type of the container, this is used to define which kind of content elements can be pulled in here.
- Now we need a content that can be pulled in there. So we must define one first:
- Go to the launch pad, select resource types and create a new one in there. First, you must select a module where this type i defined in, there you should select your own module "org.enerson.com". In the dialog, you must define the name of the content type, e.g. "mycontent". The xpath element name, e.g. "MyContent" (must start with a capital letter), the display type name (the "nice" name, shown in the UI) and a description. All the rest can stay the same right now.
- If you click ok, a demo schema for the content is created, a demo formatter and its config is created and the new type is registered in the system. Once everything is created, you can of course modify the schema to have other content fields in it and modify the formatter. But right now, we stay with the example that was created.
- The only thing we change now is in the created formatter config /system/modules/org.enerson.com/fomratters/mycontent.xml. Open it and remove the value for "Container pixel with" with the scissor symbol. Instead press the "+" on "Matching containers", select "Container types" and enter "content" as the container type. Remember the template above where we had defined a container of the type "content"? We just matched our formatter that this one can be pulled into the container in the template.
-Finally, we can create a new site. Use it as you had it on your screenshot, just select your own template in there which is now available in the drop down. The system then creates the basic structure and files for your site.
- Use the site selector to switch to your new site "1408" and click on the index html in there. You will now see your template with a red placeholder where you can pull in your content. Use the new wizard and drag & drop the content type "mycontent" in the red place holder and edit it.
- The new wizard also shows all content type of the Mercury demo, but they cannot be pulled into your template as they do not math the container in it. Of course you can configure your system that those contents do not appear in your site, but I just wanted to stick to the basic steps here.
Anyone?
Best regards, Atle Enersen.
--
Telefon: +47 48 06 31 71
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20250501/f26776bb/attachment.htm>
More information about the opencms-dev
mailing list