加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

kettle对xml的追加写入

发布时间:2020-12-16 08:30:23 所属栏目:百科 来源:网络整理
导读:最近研究xsl解析xml生产html功能;实现过程中发现生成 特定格式的xml 文件比较麻烦。kettle本身提供xml生产组件;但是太弱了,捣腾了好久终于实现了;今天有空把它贴出来。 xml写入方式一) 作业设计如图: 生产xml数据如下: ?xml version="1.0" encoding="

最近研究xsl解析xml生产html功能;实现过程中发现生成 特定格式的xml 文件比较麻烦。kettle本身提供xml生产组件;但是太弱了,捣腾了好久终于实现了;今天有空把它贴出来。


xml写入方式一)

作业设计如图:


生产xml数据如下:

<?xml version="1.0" encoding="UTF-8"?>
<Rows>
<Row><school_id>1</school_id> <teacher_name>tom</teacher_name> <student_name>juli</student_name> <location>shenzhen</location> </Row>
<Row><school_id>2</school_id> <teacher_name>jack</teacher_name> <student_name>lurry</student_name> <location>shanghai</location> </Row>
<Row><school_id>3</school_id> <teacher_name>rose</teacher_name> <student_name>aiven</student_name> <location>guangzhou</location> </Row>
</Rows>


xml写入方式二)



xml结果数据如下:



<?xml version="1.0" encoding="UTF-8"?> <root> <teacher> <Row> <teacher_id>1</teacher_id> <teacher_name>tom</teacher_name> </Row> <Row> <teacher_id>2</teacher_id> <teacher_name>jack</teacher_name> </Row> <Row> <teacher_id>3</teacher_id> <teacher_name>rose</teacher_name> </Row> </teacher> <student> <Row> <student_id>1</student_id> <student_name>juli</student_name> </Row> <Row> <student_id>2</student_id> <student_name>lurry</student_name> </Row> <Row> <student_id>3</student_id> <student_name>aiven</student_name> </Row> </student> <location> <Row> <location_id>1</location_id> <location>shenzhen</location> </Row> <Row> <location_id>2</location_id> <location>shanghai</location> </Row> <Row> <location_id>3</location_id> <location>guangzhou</location> </Row> </location> </root>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读