[opencms-dev] New XML Structured Content - How to get it to show up?

Weide Chen gmail8000-opencms at yahoo.com
Wed Feb 23 15:05:56 CET 2005


OK, apparantly that is a lot of info to digest.
Thanks. 

Anyway, I found out the following which is simpler to
configure after tinkering with the
(opencms-modules.xml)config file.

1) I found out that the resource.type.id value is
arbritary.  As long as the value has not been used, I
can assign any value to it.  In this case, I selected
a large integer value.  Once you start creating any
content using this form (that's how I would like to
call it), the data stored in the table now has a
RESOURCE_TYPE value 0f 5001.  Apparantly, if you
delete the original XSD file, something will break
after the content record has been created.

                <type
class="org.opencms.file.types.CmsResourceTypeXmlContent">
                    <param
name="resource.type.id">5001</param>
                    <param
name="resource.type.name">news</param>
                    <param
name="schema">/sites/mysite/xmlcontent/news.xsd</param>
                </type>		 

2) The next thing is to include the following segment
to the same (opencms-modules.xml) file.  

                <explorertype name="news"
key="fileicon.news" icon="xmlcontent.gif"
reference="xmlcontent">
                    <newresource
page="structurecontent"
uri="newresource_xmlcontent.jsp?newresourcetype=news"
order="28"/>
                    <accesscontrol>
                        <accessentry
principal="GROUP.Administrators"
permissions="+r+v+w+c"/>
                        <accessentry
principal="GROUP.Projectmanagers"
permissions="+r+v+w+c"/>
                        <accessentry
principal="GROUP.Users" permissions="+r+v+w+c"/>
                    </accesscontrol>
                </explorertype>        
 
3) Next, I am piggy-backing on 
org.opencms.frontend.templateone.xmlcontentdemo
module.  I therefore need to update the
workplace.properties file to include fileicon.news
value to have it appear on the Structured Contetn
selection.  Otherwise, it will appear as
???fileicon.news??? in the selection list.

Anyway, I am looking into how to render this content
record next, i.e. I would like to render the record
such as news_001.html into a HTML content that can
later be exported.


Any pointers or help from anybody?  Thanks.

Weide



--- Marek <mareknow-pbc at o2.pl> wrote:

> Try the below:
> 
> 
> AW: [opencms-dev] XML Content Demo
> Armen Markarian {a.markarian at alkacon.com }
> Tue Nov 2 10:39:12 CET 2004
> 
>   * Previous message: {[opencms-dev] XML Content
> Demo }
>   * Next message: {[opencms-dev] XML Content Demo }
>   * Messages sorted by: {[ date ]} {[ thread ]} {[
> subject ]} {[ author ]}
> 
> ------------------------------------
> 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}
> 
> 
> ------------------------------------
>   * Previous message: {[opencms-dev] XML Content
> Demo }
>   * Next message: {[opencms-dev] XML Content Demo }
>   * Messages sorted by: {[ date ]} {[ thread ]} {[
> subject ]} {[ author ]}
> 
> ------------------------------------
> {More information about the opencms-dev mailing
> list}
> > 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").
> 
> The images are based on the resource type. So you
> need to configure a new
> resource type (in "WEB-INF/config/opencms-vfs.xml").
> Then there is the "new"
> dialog which is part of the workplace. You need to
> edit
> "opencms-workplace.xml" for that. Check out these 2
> files and search for
> "xmlcontent" and "article". In short, it's really
> simple to add a new type
> based in XML content.... Best Regards,
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "Weide Chen" <gmail8000-opencms at yahoo.com>
> To: <opencms-dev at opencms.org>
> Sent: Tuesday, February 22, 2005 3:41 PM
> Subject: [opencms-dev] New XML Structured Content -
> How to get it to show 
> up?
> 
> 
> > Hi,
> >
> > Does anyone know how I can get the XSD file that I
> > have created to show up in the new Structured
> Content?
> > I have just installed OpenCms6.0B1 on Tomcat 5.0.
> >
> > For example, I have created an XSD file called
> > mynews.xsd, but this does not show up when I
> selected
> > the Create New Structure Content option.  It seems
> > that I need to create some kind of resource type,
> but
> > do not where and how to do so.
> >
> > By the way, there is an entry on all the sample
> XSD
> > files (i.e. article.xsd etc) that appear in
> > opencms-modules.xml file.  It reads
> >
> >                <type
> >
>
class="org.opencms.file.types.CmsResourceTypeXmlContent">
> >                    <param
> > name="resource.type.id">12</param>
> >                    <param
> > name="resource.type.name">article</param>
> >                    <param
> >
>
name="schema">/sites/default/xmlcontent/article.xsd</param>
> >                </type>
> >
> > Do I have to include any added xsd file in here? 
> If
> > so, how would I know what the "resource.type.id"
> value
> > is?
> >
> > Thanks.
> >
> > Weide
> >
> >
> >
> > _______________________________________________
> > 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