[opencms-dev] XML Structured Content in alpha 2 and HEAD

Jorge González informatico at hotelparadisepark.com
Wed Nov 17 13:26:55 CET 2004


Thanks Alex,

I've changed the test.xsd file, now it works fine.
I think the error is in the xsd, because i didn't create the attributes that
match with the 	<xsd:appinfo>
			<mapping ...
ones, that is,
There must exist elements with matching names with the mapping ones.

If you create a
<mapping element="Title" mapto="property:Title" />
You must have a
<xsd:element name="Title" type="OpenCmsString" />

If this doesn't exist, the new contents are not created, and the system
doesn't complain about it. Validate the XSD this way could be a nice
improvement perhaps.

The working xsd is
------------------------
<?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="Tests" type="OpenCmsTests"/>

	<xsd:complexType name="OpenCmsTests">
		<xsd:sequence>
			<xsd:element name="Test" type="OpenCmsTest" minOccurs="0"
maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="OpenCmsTest">
		<xsd:sequence>
			<xsd:element name="Title" type="OpenCmsString" />
			<xsd:element name="Name" type="OpenCmsString" />
			<xsd:element name="Slogan" type="OpenCmsString" />
			<xsd:element name="Description" type="OpenCmsString" />
			<xsd:element name="Release" type="OpenCmsDateTime" />
		</xsd:sequence>
		<xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
	</xsd:complexType>

	<xsd:annotation>
		<xsd:appinfo>
			<mapping element="Title" mapto="property:Title" />
			<mapping element="Release" mapto="attribute:datereleased" />
		</xsd:appinfo>
	</xsd:annotation>
</xsd:schema>
-------------------------------------


Jorge.




More information about the opencms-dev mailing list