[opencms-dev] nested xml content

Андрей Дарбинян adarby at bk.ru
Fri Dec 24 16:17:51 CET 2004


Hello all!

I've recently tried openCMS 6 alpha 3 and really liked the new features. 
One thing among them is a possibility to have nested XML content and thus to have all my content of the same type in a single file, easily editable by the built-in editor.

There was a few problems i could not solve though, maybe you can help me with them:

1) I could not read named elements from nested xml files. As i would normally do via JspActionElement.getContent("somefile.xml","elementname",locale)

Is there a possibility to do so at all? 

2) I failed to set default values to elements via <defaults> for the inner nested xml elements
Tried to set them both in inner and outer xsd files. 

Example:

----------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	
	<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>	
	<xsd:element name="Areas" type="OpenCmsAreas"/>
	
	<xsd:complexType name="OpenCmsAreas">
		<xsd:sequence>
			<xsd:element name="Area" type="OpenCmsArea" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="OpenCmsArea">
		<xsd:sequence>
			<xsd:element name="shape" type="OpenCmsString" />
			<xsd:element name="coords"  type="OpenCmsString" />
                        <xsd:element name="info"  type="OpenCmsHtml" />
		</xsd:sequence>
                <xsd:attribute name="language" type="OpenCmsLocale" use="optional"/>
	</xsd:complexType>

	<xsd:annotation>
		<xsd:appinfo>
			<defaults>
                                <default attribute="language" value="${request:locale}" />
				<default element="shape" value="rect"/>
                        </defaults>
		</xsd:appinfo>

	</xsd:annotation>  
</xsd:schema>
-----------------------------------------------------------------------------------------

Am i missing something, or is it not possible?

3) I saw a nice snippet gallery widget. Is it possible to somehow reuse it and make it so that you can load source code of snippet of your choice into the wysiwyg edit field (for OpenCmsHtml type element).
I know nearly everything is possible in programmer's world :), but i'm really looking for somewhat easy solution, without much hacking of the openCMS code. 

Big thanks for your comments in advance

Best regards, 
Andrey






More information about the opencms-dev mailing list