XSL处理WebService报文
来源:互联网 发布:深圳知豆电动汽车 编辑:程序博客网 时间:2024/06/05 15:37
- XML
<?xml version="1.0" encoding="UTF-8"?>
//IE中直接查看XSL样式
<?xml-stylesheet type="text/xsl" href="C:/mytest/myaxis/WebContent/comments.xsl"?>
//webservice包体
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
//自定义默认命名空间http://www.com
<getCommentsResponse xmlns="http://www.com">
//结果为对象数组
<getCommentsReturn>
<anonymity>true</anonymity>
<commentId>1</commentId>
<commenter>王一</commenter>
//HTML标签
<content>匿名评论:)good!<img src='1.jpg' /></content>
<contentId>100</contentId>
</getCommentsReturn>
<getCommentsReturn>
<anonymity>false</anonymity>
<commentId>2</commentId>
<commenter>张三</commenter>
<content>署名评论:)good!<img src='2.jpg' /></content>
<contentId>100</contentId>
</getCommentsReturn>
</getCommentsResponse>
</soapenv:Body>
</soapenv:Envelope>
- XSL
<?xml version="1.0" encoding="UTF-8"?>
//定义所以命名空间
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.com">
//匹配包体
<xsl:template match="/soapenv:Envelope/soapenv:Body" >
<table border="1px #000000" >
<thead>
<tr>
<td>评论序号</td>
<td>评论者</td>
<td>内容</td>
</tr>
</thead>
<tbody>
//查找自定义默认命名空间http://www.com
//多条数据循环处理
<xsl:for-each select="p:getCommentsResponse/p:getCommentsReturn" >
<tr>
//取值显示
<td><xsl:value-of select="p:commentId"/></td>
<td>
//条件判断
<xsl:if test="p:anonymity = 'false' ">
<xsl:value-of select="p:commenter"/>
</xsl:if>
</td>
//HTML标签不做转化
<td><xsl:value-of select="p:content" disable-output-escaping="yes"/></td>
</tr>
</xsl:for-each>
</tbody>
<tfoot>
<tr>
<td align='left' colspan='3' >
//CDATA中数据不做转化
上一页<xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>下一页
</td>
</tr>
</tfoot>
</table>
</xsl:template>
</xsl:stylesheet>
- XML调试工具
AltovaXMLspy
- XSL处理WebService报文
- WebService服务中,将写原始报文日志的功能由单独线程处理
- Java WebService查看请求报文
- webservice服务报文查看工具
- 交换机报文处理方式
- linux报文处理流程
- linux报文处理
- Python处理Json报文
- CANopen协议报文处理
- 处理xml返回报文
- CANopen协议报文处理
- 从收到报文到处理报文
- WebService soap报文请求与响应报文解析
- 如何根据请求报文跟返回报文写webservice接口
- 手动发送xml报文调用webservice
- 接口程序:webservice发送报文一:
- 接口程序:webservice发送报文二:
- Webservice 之axis1.4 报文拦截
- 对SQL说不!NoSQL的数据库技术革命
- 改变窗口大小问题
- SVN的安装配置 以及与MyEclipse 整合使用开发
- 使用 CookieContainer 使用 Visual C#.NET 时维护 Web 服务中的状态
- 项目管理手记(17) ERP实施前与老板要定“三大纪律、八项注意”
- XSL处理WebService报文
- Delphi打開任何Windows支持文件
- 从MRP导入到POmodule的PR
- Delphi上傳附件文件
- 如何有效防止Java程序源码被人偷窥
- Devexpress学习篇(请大家多多指教)
- java截取带html标签的字符串并把标签补全(保证格式)
- 得到一个网页的纯文字内容
- PHP递归函数