OpenCms:如何从多个架构文件访问 xml 元素内容

发布于 2024-09-15 01:28:27 字数 137 浏览 4 评论 0原文

我对 OpenCms 中的 xml 结构化内容有疑问。我有两个 XML 架构,一个用于编辑顶部菜单(所有页面的菜单都相同),另一个架构用于编辑页面内容。在模板 jsp 文件中,我需要从两个架构文件访问 xml 元素内容。该怎么做呢?我必须在 中指定一些内容吗?

I have a doubt regarding xml structured content in OpenCms. I have two XML schemas, one for editing the top menus (menus are same across all the pages) and another schema for editing the page content. In the template jsp file i need to access xml element contents from both the schema files. How to go for that? do i have to specify something in ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

年少掌心 2024-09-22 01:28:27

您可以将一个 xsd 嵌入到另一个 xsd 中。首先,通过 menu.xsd 定义菜单,然后将其包含在 ie page.xsd 中:

<xsd:include schemaLocation="opencms://system/modules/com.yourmodule.www/schemas/menu.xsd"/>
...
<xsd:element name="Menu" type="OpenCmsMenu" minOccurs="1" maxOccurs="1" />

其中“OpenCmsMenu”需要是您在 menu.xsd 中定义的类型名称。

You can embed one xsd into another. First you define your menu via menu.xsd, then you include it like this in your i.e. page.xsd:

<xsd:include schemaLocation="opencms://system/modules/com.yourmodule.www/schemas/menu.xsd"/>
...
<xsd:element name="Menu" type="OpenCmsMenu" minOccurs="1" maxOccurs="1" />

where 'OpenCmsMenu' needs to be the type name as you defined it in your menu.xsd.

情绪少女 2024-09-22 01:28:27

另一种解决方案可能是从文件夹结构生成菜单。这是 OpenCms 中处理菜单的常用方法。

An alternative solution might be to generate the menus from the folder structure. That is the usual method to deal with menus in OpenCms.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文