使用XSLT从xml中删除xmlns,SOAP:Envelope,SOAP:Body

时间:2016-07-08 12:00:55

标签: xslt

我正在使用XSLT转换项目中的xml响应。我有以下xml。

<?xml version="1.0" encoding="UTF-8"?>
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP:Body>
      <response:performJobResponse xmlns:response="http://tempuri.org/" SOAP:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <whiteboard>
            <PQ>
               <SOAP:Envelope SOAP:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                  <SOAP:Body>
                     <response:performJobResponse SOAP:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                        <whiteboard>
                           <PQ>
                              <SOAP:Envelope SOAP:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                                 <SOAP:Body>
                                    <performJob loadfromcache="yes">
                                       <jobName>PQIssueUpdate</jobName>
                                       <whiteboard>
                                          <PQ>
                                             <PQContact>
                                                <userID>Test</userID>
                                                <password>Test@2</password>
                                             </PQContact>
                                             <workflowStatusComment>
                                                <comment>Issue released.  Routing Status changed from CATCHALL to Pharmancy.  Issue updated by user DT76747.</comment>
                                             </workflowStatusComment>
                                          </PQ>
                                       </whiteboard>
                                       <requestNodeName>//PQ</requestNodeName>
                                       <responseNodeName>//PQ</responseNodeName>
                                       <jobDB>
                                          <name>PQCustomerService</name>
                                          <userID>sa</userID>
                                          <password>password</password>
                                       </jobDB>
                                    </performJob>
                                 </SOAP:Body>
                                 <response>
                                    <DST xml:lang="en-US">
                                       <jobName version="1.0">SRVChangeLock</jobName>
                                       <trace>0</trace>
                                       <readable>N</readable>
                                       <AWD>
                                          <userID>DT76747</userID>
                                          <password>Removed for security purposes</password>
                                          <transaction id="2016-07-07-02.02.19.127220T01">
                                             <createTime time="Y">2016-07-07T02:02:19:127220-05:00</createTime>
                                             <assignedTo>DT76747</assignedTo>
                                             <lockedBy>DT76747</lockedBy>
                                             <customScreen>WRKXMPL</customScreen>
                                             <workflow route="Status">
                                                <workStep status="_NEXT" next="Y" />
                                             </workflow>
                                          </transaction>
                                       </AWD>
                                       <jobVersion>1.0</jobVersion>
                                       <jobReturn jobName="SRV00017">
                                          <taskName />
                                          <description />
                                          <value>0</value>
                                       </jobReturn>
                                    </DST>
                                 </response>
                              </SOAP:Envelope>
                           </PQ>
                        </whiteboard>
                     </response:performJobResponse>
                  </SOAP:Body>
                  <response>
                     <DST xml:lang="en-US">
                        <jobName version="1.0">SRVObjectUpdate</jobName>
                        <trace>0</trace>
                        <readable>N</readable>
                        <AWD>
                           <userID>DT76747</userID>
                           <password>Removed for security purposes</password>
                           <transaction id="2016-07-07-02.02.19.127220T01" workSelected="false" hasChildWork="N" children="N" hasParent="Y" hasParentCase="Y" hasChildSource="N">
                              <id>2016-07-07-02.02.19.127220T01</id>
                           </transaction>
                        </AWD>
                     </DST>
                  </response>
               </SOAP:Envelope>
            </PQ>
         </whiteboard>
         <jobReturn>
            <value>0</value>
         </jobReturn>
      </response:performJobResponse>
   </SOAP:Body>
</SOAP:Envelope>

我想删除所有xmlns内容,SOAP:Envelope<SOAP:Body><response>标记相关内容。

我的最终xml应如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<PQ>
   <PQContact>
      <userID>Test</userID>
      <password>Test@2</password>
   </PQContact>
   <workflowStatusComment>
      <comment>Issue released.  Routing Status changed from CATCHALL to Pharmancy.  Issue updated by user DT76747.</comment>
   </workflowStatusComment>
</PQ>

你能帮帮我吗?

1 个答案:

答案 0 :(得分:1)

请尝试这种转变:

conv1 = tf.nn.conv2d(image, weights, [1, 1, 1, 1], 'SAME')
layer1 = tf.image.resize_bilinear(conv1, (224, 224))
...
layer2 = tf.image.resize_bilinear(conv2, (224, 224))
...
layer3 = tf.image.resize_bilinear(conv3, (224, 224))
return(tf.concat(0, [layer1, layer2,layer3]))