需要删除 <?xml version="1.0";编码=“utf-16"?>从 xml [英] Need to remove <?xml version="1.0" encoding="utf-16"?> from the xml
本文介绍了需要删除 <?xml version="1.0";编码=“utf-16"?>从 xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在通过将 xsl 应用到 xml 输入来生成 xml.我需要没有这部分的输出 "<?xml version="1.0" encoding="utf-16"?>"
Hi i am generating a xml by appying the xsl to a xml input. I need the output without this part "<?xml version="1.0" encoding="utf-16"?>"
输入--xml
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CreateResponse xmlns="http://jerseytelecom.com/">
<CreateResult>
<ISD_XMLGateway>
<Entity>RIM_BPS</Entity>
</ISD_XMLGateway>
</CreateResult>
</CreateResponse>
</soap:Body>
</soap:Envelope>
我的 xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:JT="http://jerseytelecom.com/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="JT">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:element name="Entity">
<xsl:value-of select="soap:Envelope/soap:Body/JT:CreateResponse/JT:CreateResult/JT:ISD_XMLGateway/JT:Entity"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
电流输出
<?xml version="1.0" encoding="utf-16"?>
<Entity>RIM_BPS</Entity>
预期输出
<Entity>RIM_BPS</Entity>
推荐答案
尝试将 omit-xml-declaration="yes"
属性添加到您的 xsl:output
标记.
Try adding the omit-xml-declaration="yes"
attribute to your xsl:output
tag.
它应该是这样的:
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
这篇关于需要删除 <?xml version="1.0";编码=“utf-16"?>从 xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文