[opencms-dev] xsd: defintion of attributes
Shi Yusen
shiys at langhua.cn
Sat May 6 17:10:04 CEST 2006
Hi Nadine,
I think your requirement is possible in OpenCMS.
You can create a new resource type extended from xmlcontent and a new editor extended from xmlcontent editor, overlap the editor's reading and writing parts. When reading, parse the file from original xml format to a xmlcontent format. When writing, vice versa.
Good luck,
Shi Yusen/Beijing Langhua Ltd.
________________________________________
发件人: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] 代表 schuchhardt at inverso.de
发送时间: 2006年5月5日 22:31
收件人: opencms-dev at opencms.org
主题: [opencms-dev] xsd: defintion of attributes
Hi everybody,
I´m trying to realize the following xml-file to be editable in OpenCms with
structured content. Till now I worked with the examples in the documentation and everything was ok.
I searched the mailing list but I found nothing similar.
Besides I´ve got the opinion that it is only possible to implement nothing execpt the given examples .
The complex types for example seem not to be allowed to have more than the language attribute.
When I try to define some further attributes to complex types of the xsd, I alwyas get errors.
Has anybody succesfully written schema definitions for a xml file like that?
<?xml version="1.0" encoding="ISO-8859-1"?>
<Productinhalt Version="2.1.0" Name="Konfiguration">
<Product Key="02001" Name="" ProductServer="" ProductPort="52224" ProductPath="">
</Product>
<Product Key="23001" Name="" ProductServer="" ProductPort="52224" ProductPath="">
</Product>
</Productinhalt>
My last working schema looked like this, but it is only possible with diffentent elements, not with several attributes.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
<xsd:element name="Productinhalts" type="OpenCmsProductinhalts" />
<xsd:complexType name="OpenCmsProductinhalts">
<xsd:sequence>
<xsd:element name="Productinhalt" type="OpenCmsProductinhalt" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="OpenCmsProductinhalt">
<xsd:sequence>
<xsd:element name="Key" type="OpenCmsString" />
<xsd:element name="Name" type="OpenCmsString" />
<xsd:element name="ProductServer" type="OpenCmsString" />
<xsd:element name="ProductPort" type="OpenCmsString" />
<xsd:element name="ProductPath" type="OpenCmsString" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale" use="required" />
</xsd:complexType>
<xsd:annotation>
<xsd:appinfo>
<resourcebundle name="de.inverso.vkb.vp.workplace"/>
<mappings/>
<defaults/>
<layouts/>
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
Result xml file:
<?xml version="1.0" encoding="UTF-8"?>
<Productinhalts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="opencms://system/modules/de.inverso.vkb.vp/schemas/vp_content.xsd">
<Productinhalt language="en">
<Product>
<Key><![CDATA[02001]]></Key>
<Name/>
<ProductServer/>
<ProductPort><![CDATA[52224]]></ProductPort>
<ProductPath/>
</Product>
<Product>
<Key><![CDATA[23001]]></Key>
<Name/>
<ProductServer/>
<ProductPort><![CDATA[52224]]></ProductPort>
<ProductPath/>
</Product>
</Productinhalt>
</Productinhalts>
Thanks for your help!
Best regards,
Nadine Schuchhardt
More information about the opencms-dev
mailing list