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

需要从xml中删除<?xml version =“1.0”encoding =“utf-16

发布时间:2020-12-16 08:00:05 所属栏目:百科 来源:网络整理
导读:您好,我通过将xsl应用于xml输入来生成xml。我需要没有这部分的输出“?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=
您好,我通过将xsl应用于xml输入来生成xml。我需要没有这部分的输出“<?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标签。

它应该这样读:

<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />

(编辑:李大同)

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

    推荐文章
      热点阅读