[opencms-dev] nested xml content

Alexander Kandzior alex at opencms.org
Sun Dec 26 10:29:09 CET 2004


In order to nest XML content schemas, the nested element mut be in it's own
file that gets included by the first schema. Please see the demos in the
xmlcontent demo folder.

Please note that the XML content schemas must follow some very strict rules
on how they are written. This includes naming rules and strcuturing rules.
All this is required to give a decent runtime performance. OpenCms uses some
very slim classes to represent the XML schemas during runtime, and these
classes do support only a limited subset of all XML schema options. 

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

 

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Ulrich Rueth
> Sent: Saturday, December 25, 2004 12:07 AM
> To: Aia?ae Aa?aeiyi; The OpenCms mailing list
> Subject: AW: [opencms-dev] nested xml content
> 
> Hi Andrey,
> 
> sorry, I cannot really help you on your problems, but I have 
> a question myself on the nested xml content. Did you succeed 
> in nesting another complex element inside the second global 
> nested element? I did not, although I thought this was 
> possible with alpha 3. Maybe I misunderstood something?
> 
> Thanks in advance for your help.
> 
> Regards
> Ulrich
> 
> Example of what I want but did not work (see the "Section" element):
> 
> <?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="InfoRuethArticles" 
> type="OpenCmsInfoRuethArticles"/>
> 
> 	<xsd:complexType name="OpenCmsInfoRuethArticles">
> 		<xsd:sequence>
> 			<xsd:element name="InfoRuethArticle" 
> type="OpenCmsInfoRuethArticle"
> minOccurs="0" maxOccurs="unbounded"/>
> 		</xsd:sequence>
> 	</xsd:complexType>
> 
> 	<xsd:complexType name="OpenCmsInfoRuethArticle">
> 		<xsd:sequence>
> 			<xsd:element name="Title" 
> type="OpenCmsString" />
> 			<xsd:element name="Subtitle" 
> type="OpenCmsString"/>
> 			<xsd:element name="Keywords" 
> type="OpenCmsString"/>
> 			<xsd:element name="Teaser" 
> type="OpenCmsString"/>
> 			<xsd:element name="Author" 
> type="OpenCmsString"/>
> 			<xsd:element name="Date" 
> type="OpenCmsDateTime"/>
> 			<xsd:element name="Publisher" 
> type="OpenCmsString" use="optional"/>
> 			<xsd:element name="Copyright" 
> type="OpenCmsString" use="optional"/>
> 			<xsd:element name="Section" 
> maxOccurs="unbounded">
> 				<xsd:complexType>
> 					<xsd:sequence>
> 						<xsd:element 
> name="Text" type="OpenCmsHtml"/>
> 						<xsd:element 
> name="Info" type="OpenCmsString" minOccurs="0"
> maxOccurs="unbounded"/>
> 					</xsd:sequence>
> 					<xsd:attribute 
> name="sectiontitle" use="optional"/>
> 				</xsd:complexType>
> 			</xsd:element>
> 		</xsd:sequence>
> 		<xsd:attribute name="language" 
> type="OpenCmsLocale" use="required"/>
> 	</xsd:complexType>
> </xsd:schema>
> 
> -----Ursprungliche Nachricht-----
> Von: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org]Im Auftrag von Андрей Дарбинян
> Gesendet: Freitag, 24. Dezember 2004 16:18
> An: opencms-dev at opencms.org
> Betreff: [opencms-dev] nested xml content
> 
> 
> 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
> 
> 
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list To 
> change your list options, or to unsubscribe from the list, 
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list To 
> change your list options, or to unsubscribe from the list, 
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 




More information about the opencms-dev mailing list