AW: [opencms-dev] XML Content Demo

Armen Markarian a.markarian at alkacon.com
Tue Nov 2 10:39:12 CET 2004


Hi John, 

You have to edit the XSD Schema. 

<xsd:sequence>
	<xsd:element name="Title" type="OpenCmsString" />
	...
      // this opens a fileselector child
	<xsd:element name="Picture" type="OpenCmsVfsFile" />
</xsd:sequence>

Regards,

Armen Markarian
Alkacon Software - The OpenCms Experts
http://www.alkacon.com 

-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] Im Auftrag von John Giammarche
Gesendet: Montag, 1. November 2004 13:50
An: The OpenCms mailing list
Betreff: RE: [opencms-dev] XML Content Demo


Thanks for replaying hime, I also taked note =).

One thing I'd like to know: is there a way to have the article/myArticle
type have an image associated with it? I don't mean to add it via the
WYSIWYG editor, but to have an input field in the wizard that appears
when you click on the Magic Wand ("new").

Thanks in advance,

John
--- Alexander Kandzior <alex at opencms.org> wrote:

> > Version 6 is fantastic! I'm still getting to know
> the system.
> >  I was going to use version 5 for a website being
> put up in
> > about a month, but I need the functionality of the
> XML
> > Content.  I was going to make my own Content
> Definition and
> > module, but the XML content method seems more
> powerful, and
> > easier to duplicate.  I know there is no formal
> documentation
> > for version 6, but if someone could just give me a
> layout of
> > the basic steps to create my own xml content I
> would really
> > appreciate it.
> 
> Here's the short overview about how to create XML
> content definitions. Feel
> free to ask additional questions if something seems inclomplete.
> 
> 1. Start with the XML schema
> You first need to define the XML content structure.
> To do this, create an
> XML schema (currently this is just a "plain" file).
> The XML schema mut
> follow the layout of the demo files. Check out 
> "/xmlcontent/article.xsd" and all files in
>
"/system/modules/org.opencms.frontend.templateone/schemas/"
> which give you a couple of examples. Please note
> that the layout is
> mandatory, in case you make any mistake it wont
> word. A fine point is that
> there's always an "inner" and "outer" node name,
> e.g. "article" and
> "articles". The "outer" name _must_ be the inner
> name with an "s" appended.
> For the current choice of available data types check
> the demos and the file
> "opencms-vfs.xml". For the beginning, I recommend
> you start with a very
> small schema, maybe based on "article.xsd" where you
> _remove_ most of the
> nodes, and rename the schema to "myarticle". Just
> leave the title data
> field.
> 
> The first schema might look like this:
> <?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="myarticles"
> type="OpenCmsMyArticles"/>
> 	
> 	<xsd:complexType name="OpenCmsMyArticles">
> 		<xsd:sequence>
> 			<xsd:element name="myarticle"
> type="OpenCmsMyArticle" minOccurs="0"
> maxOccurs="unbounded"/>
> 		</xsd:sequence>
> 	</xsd:complexType>
> 
> 	<xsd:complexType name="OpenCmsMyArticle">
> 		<xsd:sequence>
> 			<xsd:element name="title" type="OpenCmsString"
/>
> 		</xsd:sequence>
> 		<xsd:attribute name="language"
> type="OpenCmsLocale"
> use="required"/>
> 	</xsd:complexType>
> 
> 	<xsd:annotation>
> 		<xsd:appinfo>
> 			<mapping element="Title" mapto="property:Title"
> />
> 		</xsd:appinfo>
> 	</xsd:annotation>
> </xsd:schema>
> 
> 
> 
> 2. Create a content with the new schema.
> Since the schema is not yet available for creating
> "new" files, you must do
> that manually. Create a new file of type "Generic
> XML content". This will be
> just an empty file. Now open that file with "Edit
> controlcode". Then supply
> a valid XML for the schema, like this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <myarticles
>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
xsi:noNamespaceSchemaLocation="opencms://sites/default/xmlcontent/myarti
cle.
> xsd">
>   <myarticle language="en">
>     <title><![CDATA[Sample article 1]]></title>
>   </myarticle>
> </mayrticles>
> 
> The fine point here's the pointer to the XML schema
> in the VFS using
>
xsi:noNamespaceSchemaLocation="opencms://sites/default/xmlcontent/myarti
cle.
> xsd". You mut point to the location of your schema
> here.
> 
> Note that the "Edit controlcode" editor will not
> allow you to save the
> content if either the schema contains errors, or the
> XML is not formed
> according to the schema. So if you can't save, check
> that both the schema
> and the XML is vaild. Once you are able to save, you
> are certain that it
> worked.
> 
> 
> 3. Open the created file using "Edit".
> Now you should see the "nice" editor, that displays
> the node name "title"
> and an input field for that. 
> 
> 
> 4. Create a "detail" page.
> The demo contains a "full featured" example. Here's
> like the "minimum
> version", without a template:
> 
> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
> 
> <cms:contentload collector="singleFile"
> param="opencms:uri" editable="true">
> <h1><cms:contentshow element="Title" /></h1> </cms:contentload>
> 
> Save this file as "mydetail.jsp".
> 
> 
> 5. Connect the detail page to the XMl content using
> the "template-elements"
> property.
> At this point, I recommend moving everything into a
> new folder, called e.g.
> "myfolder". This folder should now contain the XML
> schema, the one
> "myarticle" created and the detail page
> "mydetail.jsp". Note that you must
> manually correct the schema location in the
> "myarticle" since the file was
> moven in the VFS.
> 
> Now, open the properties of "myfolder", and switch
> to "Advanced" mode.
> Locate the "template-elements" property on the lower
> half of the screen.
> Into this propety you must point to the location of
> the detail page, so add
> "/myfolder/mydetail.jsp" as propety value.
> 
> Save the properties and go into the "myfolder"
> again. Click on the created
> "myarticle". It should now be displayed using the
> created detail page. Note
> that the reason why in our demos all XML files and
> with ".html" is to make
> sure the "html" mimetype is used. If your XMl
> content does not end with
> .html, there might be issues displaying it correctly
> because of a wring mime
> type.
> 
> 
> 6. Create an overview list page
> Now create a JSP page "mylist.jsp" in "myfolder".
> The mimimum version might
> look like this:
> 
> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
> 
> <cms:contentload
> collector="allInFolderDateReleasedDesc"
> param="/myfolder/myarticle_${number}.html|11"
> editable="true">
> <h3><cms:contentshow element="Title" /></h3> </cms:contentload>
> 
> Click on the page. It should now display your single myarticle. Note 
> that you can now create a new article using the "wizard
> wand". 
=== message truncated ===



		
_______________________________
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. 
http://messenger.yahoo.com


_______________________________________________
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