简体   繁体   中英

OpenCms : How to access xml element content from multiple schema files

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 ?

You can embed one xsd into another. First you define your menu via menu.xsd, then you include it like this in your 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" />

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM