如何从XML输出以下内容?

如何从XML输出以下内容?,xml,Xml,我想展示XML文档的以下输出,但我不确定如何实现。有人能帮忙吗 所需输出: <?xml version="1.0" encoding="UTF-8"?> <Integration> <ProtectionOrderStatus> <ProtectionOrderStatusCode>DELETED</ext:ProtectionOrderStatusCode> </ProtectionOrderSta

我想展示XML文档的以下输出,但我不确定如何实现。有人能帮忙吗

所需输出:

<?xml version="1.0" encoding="UTF-8"?>
<Integration>
   <ProtectionOrderStatus>
        <ProtectionOrderStatusCode>DELETED</ext:ProtectionOrderStatusCode>
    </ProtectionOrderStatus>
</Integration>
<?xml version="1.0" encoding="UTF-8"?>
<Integration>
    <ProtectionOrder>
        <Deleted>true</Deleted>
        <ProtectionOrderNumber>12</ProtectionOrderNumber>
        <Statuses>
            <Status>
                <Current>true</Current>
                <Active>Yes</Active>
                <Date>03/16/2017</Date>
                <Type Word="SBJO">Signed By Judicial Officer</Type>
            </Status>
        </Statuses>
    </ProtectionOrder>
</Integration>

删除
XML文档:

<?xml version="1.0" encoding="UTF-8"?>
<Integration>
   <ProtectionOrderStatus>
        <ProtectionOrderStatusCode>DELETED</ext:ProtectionOrderStatusCode>
    </ProtectionOrderStatus>
</Integration>
<?xml version="1.0" encoding="UTF-8"?>
<Integration>
    <ProtectionOrder>
        <Deleted>true</Deleted>
        <ProtectionOrderNumber>12</ProtectionOrderNumber>
        <Statuses>
            <Status>
                <Current>true</Current>
                <Active>Yes</Active>
                <Date>03/16/2017</Date>
                <Type Word="SBJO">Signed By Judicial Officer</Type>
            </Status>
        </Statuses>
    </ProtectionOrder>
</Integration>

符合事实的
12
符合事实的
对
03/16/2017
由司法官员签署

我不知道您的处理语言是什么。
因此,我只提供了一种XSLT-1.0方法来实现这一点:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="yes" />

    <xsl:template match="/Integration">
      <Integration>
        <xsl:apply-templates />
      </Integration>
    </xsl:template>

    <xsl:template match="ProtectionOrder[Deleted = 'true']">
      <ProtectionOrderStatus>
        <ProtectionOrderStatusCode>DELETED</ProtectionOrderStatusCode>
      </ProtectionOrderStatus>
    </xsl:template>

</xsl:stylesheet>

删除
其产出是:

<?xml version="1.0"?>
<Integration>
    <ProtectionOrderStatus>
        <ProtectionOrderStatusCode>DELETED</ProtectionOrderStatusCode>
    </ProtectionOrderStatus>
</Integration>

删除
此代码为源XML的每个
元素生成一个
ProtectionOrderStatus
元素,该元素具有
子元素,其
text()
值等于
true