Cocoon介绍

Forrest和Cocoon的使用

Cocoon介绍

是一个XML web发布系统

图 4.1. Cocoon结构

Cocoon结构
分离了context,style,logic和management

图 4.2. Cocoon的context,style,logic和management的分离

Cocoon的context,style,logic和management的分离

图 4.3. cocoon的处理流程

cocoon的处理流程

图 4.4. cocoon的Pipeline的处理

cocoon的Pipeline的处理
cocoon的Pipeline的处理

pseudo protocol

"cocoon:" is a pseudo protocol and refers to another pipeline. "cocoon:/" refers to a pipeline from the current sitemap while "cocoon://" refers to a pipeline from the root sitemap.

"context:" is another pseudo protocol, "context://" is refering to a resource using the servlet context.

"resource:" is yet another pseudo protocol, "resource://" is refering to a resource from the context classloader.

An XSP(eXtensible Server Pages) page is used by a generator to generate XML document. 在work的cocoon-files/org/apache/cocoon/www/目录中可以找到xsp生成的java文件. XSP中的逻辑单相当与jsp的tag,逻辑单是通过使用 XSLT 转换实现的XSLT 转换将 Java 代码添加到 XSP 文档来创建所期望的功能。

xsp的几种形式

  • 图 4.5. XSP 的Embedded Logic

    XSP 的Embedded Logic
    Code is embedded in the XML page, No separation of content and logic, Okay for small examples but terrible for large systems.
  • 图 4.6. XSP 的Included Logicsheet

    XSP 的Included Logicsheet
    Code is in a separate logicsheet (an XSL file), Effective separation of content and logic, 创建XSP首选的方法
  • 图 4.7. XSP 的Logicsheet as tag library

    XSP 的Logicsheet as tag library
    The logicsheet is packaged as a reusable tag library and registered with Cocoon in cocoon.xconf file. Tag library has a namespace declaration, declared in the original logicsheet and matched in <xsp:page> xmlns:... attribute. Effective separation of content, logic and management

Sitemap文件包括: matchers,generators,transformers,readers,serializers,selectors,pipelines

A Matcher attempts to match an URI with a specified pattern for dispatching the request to a specific processing pipeline.

图 4.8. sitemap.xmap文件中pipeline的处理

sitemap.xmap文件中pipeline的处理

Forrest

Forrest是在cocoon基础上开发的Xml发布系统,基本使用的看它的RELEASE文件

webapp的目录结构

	 		
context -内容
xdocs/site.xml --网站的information content
xdocs/tabs.xml--网站的主菜单项目
resources --资源,包括图像,dtd,。。。
skins--界面
WEB—INF--web配置

samples/faq.html文件的处理过程

  1. 在sitemap.xmap中配备**/*.html

  2. 用map:aggregate生成一个xml文件.

  3. 最后用site2xhtml来生成整个page,用skinconf.xml来做变量. site2xhtml.xsl is the final stage in HTML page production. It merges HTML from document2html.xsl, tab2menu.xsl and book2menu.xsl, and adds the site header,footer, searchbar, css etc. As input, it takes XML of the form

所以forrest把一个page分成了4个部分。tab,menu,context和全局的一些配置

linkrewriter有什么用, 用xdoc/site.xml来生成linker Rewrites links, e.g. transforming href="site:index" to href="../index.html"

[重要]重要

如何解决查找dtd文件的问题, 把forrest中的catalog.xcat文件copy 过来,在上面加就可以了

把xml转换成utf-8后,文件的比较就比较麻烦了!!!

其他

用xreporter如何

与Hibernate!集成

xml的数据表示技术

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值