使用 pureXML 构建通用组件库
2010-05-31 00:00:00 来源:WEB开发网清单 6. 注册 XML Schema
db2 "register xmlschema 'http://www.w3.org/2009/09/componentBase'
from component.xsd as compSchema"
DB20000I The REGISTER XMLSCHEMA command completed successfully.
db2 complete xmlschema compSchema
DB20000I The COMPLETE XMLSCHEMA command completed successfully.
其中, component.xsd就是清单 2所示的 XML Schema的定义文件。
然后,执行下面的脚本,将清单 4 所示的组件信息验证后保存到数据库中。
清单 7. 插入 XML 数据
insert into component(id, info) values(1, XMLVALIDATE(XMLPARSE(DOCUMENT
'<?xml version="1.0" encoding="UTF-8"?>
<component xmlns="http://www.w3.org/2009/09/componentBase"
compID="101" reference="separate"
entity="com.xicrm.business.XiJoinInStringListSeparator">
<function>concate two strings with given separator</function>
<interface>
<input type="java.lang.String" meaning="string #1"/>
<input type="java.lang.String" meaning="string #2"/>
<input type="java.lang.String" meaning="separator"/>
<output type="java.lang.String" meaning="string concated"/>
</interface>
<implement type="atomicLogic"/>
<catalog name="generic">
<detail>string operater</detail>
</catalog>
</component>' PRESERVE WHITESPACE) ACCORDING TO XMLSCHEMA ID compSchema))@
更多精彩
赞助商链接