[opencms-dev] xsd: defintion of attributes

Jonathan Woods jonathan.woods at scintillance.com
Fri May 5 16:49:56 CEST 2006


Unfortunately the XSD handling seems to be fairly hardwired, so I don't
think there's any way of doing what you want.   I don't believe it's even
possible to use <xsd:choice>, for example...
 
Jon

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of schuchhardt at inverso.de
Sent: 05 May 2006 15:31
To: opencms-dev at opencms.org
Subject: [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/sc
hemas/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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060505/437ee47e/attachment.htm>


More information about the opencms-dev mailing list