[opencms-dev] Complex articles in XML with OC6

lists at rueth.info lists at rueth.info
Mon Dec 20 19:34:01 CET 2004


Hi!

In OpenCms5 I've been using my own xml article mechanism (which is in
the OpenCms Module Sandbox for download). The principle of the OpenCms6
XML article management is a bit similar, but of course much more
advanced, and I am looking forward to using it and throwing my own
stuff away.

Still, when trying to build an article using the OpenCms6 mechanism, I
seem to encounter certain limits. This may be due to my unexperience
with this mechanism, but maybe also due to real limits of this
mechanism. For example, I need articles consisting of several sections,
each with an optional title. Each of those sections can enclose text,
images and links. Have a look at my old xsd file, which I paste below.

- Is it possible to get a similar article structure using the OpenCms6
article mechanism?
- If yes, how??? Examples would be highly appreciated!
- A valid OpenCms6 xsd file seems not to allow complex types nested
inside the "singular" (without the s at the end) complex type
definition, neither by defining them "anonymously" inside this type
definition, nor by adding additional "named" complex types (like I did
before, see below) and referening them by name. Is this correct?

Please help me get going, or stop me from getting too frustrated...

Regards
Ulrich

Hers's my old xsd file:

-----

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:annotation>
		<xsd:documentation xml:lang="en">Scheme for
articles</xsd:documentation>
	</xsd:annotation>
	<xsd:element name="XMLTEMPLATE" type="articleType"/>
	<xsd:complexType name="articleType">
		<xsd:sequence>
			<xsd:element name="title" type="xsd:string"/>
			<xsd:element name="subtitle" type="xsd:string"/>
			<xsd:element name="keywords" type="xsd:string"/>
			<xsd:element name="summary" type="xsd:string"/>
			<xsd:element name="author" type="xsd:string"/>
			<xsd:element name="date" type="xsd:string"/>
			<xsd:element name="publisher" type="xsd:string" minOccurs="0"/>
			<xsd:element name="language" type="xsd:string" minOccurs="0"/>
			<xsd:element name="copyright" type="xsd:string" minOccurs="0"/>
			<xsd:element name="validity" type="xsd:integer" minOccurs="0"/>
			<xsd:element name="content" type="contentType"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="contentType">
		<xsd:sequence>
			<xsd:element name="section" type="sectionType"
maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="toc" type="xsd:boolean" use="required"/>
	</xsd:complexType>
	<xsd:complexType name="sectionType">
		<xsd:sequence>
			<xsd:element name="text" type="xsd:string" minOccurs="0"/>
			<xsd:element name="infos" type="infosType" minOccurs="0"/>
			<xsd:element name="links" type="linksType" minOccurs="0"/>
			<xsd:element name="images" type="imagesType" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="title" type="xsd:string" use="optional"/>
	</xsd:complexType>
	<xsd:complexType name="infosType">
		<xsd:sequence>
			<xsd:element name="info" maxOccurs="unbounded">
				<xsd:complexType>
					<xsd:simpleContent>
						<xsd:extension base="xsd:string">
							<xsd:attribute name="title" type="xsd:string" use="optional"/>
						</xsd:extension>
					</xsd:simpleContent>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="linksType">
		<xsd:sequence>
			<xsd:element name="link" maxOccurs="unbounded">
				<xsd:complexType>
					<xsd:simpleContent>
						<xsd:extension base="xsd:string">
							<xsd:attribute name="url" type="xsd:anyURI" use="required"/>
						</xsd:extension>
					</xsd:simpleContent>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="imagesType">
		<xsd:sequence>
			<xsd:element name="image" maxOccurs="unbounded">
				<xsd:complexType>
					<xsd:attribute name="thumb" type="xsd:string" use="optional"/>
					<xsd:attribute name="url" type="xsd:string" use="required"/>
					<xsd:attribute name="caption" type="xsd:string" use="optional"/>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
</xsd:schema>



More information about the opencms-dev mailing list