我有以下XML:复制输入XML输出并删除不需要的命名空间出来的
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http:test/201/2"
xmlns:m0="http:test/201/3"
xmlns:ns0="http:test/201/4"
xmlns:ns2="http:test/201/5"
xmlns:ns1="http:test/201/6"
xmlns:ns3="http:test/201/7"
xmlns:ns6="http:test/201/8"
xmlns:ns4="http:test/201/9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<ns0:ResponseHeader>
<ns:Env>Dev</ns:Env>
<ns:Version>1</ns:Version>
<ns:Server></ns:Server>
<ns:Name>NAME</ns:Name>
</ns0:ResponseHeader>
</soap:Header>
<soap:Body>
<ns2:ResponseData>
<ns2:Employee >
<ns2:MessageList xsi:type="ns3:Info">
<ns2:Message>
<ns4:Type>new</ns4:Type>
<ns4:Code>2</ns4:Code>
<ns4:Source>Emp</ns4:Source>
<ns4:Description>new hire</ns4:Description>
</ns2:Message>
</ns2:MessageList>
<ns2:MessageList xsi:type="ns3:Info">
<ns2:Message>
<ns4:Type>new</ns4:Type>
<ns4:Code>1</ns4:Code>
<ns4:Source>contract</ns4:Source>
<ns4:Description>new hire</ns4:Description>
</ns2:Message>
</ns2:MessageList>
</ns2:Employee>
</ns2:ResponseData>
</soap:Body>
</soap:Envelope>
我的要求是,拷贝完整的输入XML元素和属性来输出XML包括除的xmlns所有命名空间:SOAP =” http://schemas.xmlsoap.org/soap/envelope/”。 所以欲望输出是:
我的要求是,复制完整的输入xml元素和属性以输出xml包括除xmlns之外的所有命名空间:soap =“http://schemas.xmlsoap.org/soap/envelope/”。 愿意的话输出是:
<Envelope
xmlns:ns="http:test/201/2"
xmlns:m0="http:test/201/3"
xmlns:ns0="http:test/201/4"
xmlns:ns2="http:test/201/5"
xmlns:ns1="http:test/201/6"
xmlns:ns3="http:test/201/7"
xmlns:ns6="http:test/201/8"
xmlns:ns4="http:test/201/9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<ns0:ResponseHeader>
<ns:Env>Dev</ns:Env>
<ns:Version>1</ns:Version>
<ns:Server></ns:Server>
<ns:Name>NAME</ns:Name>
</ns0:ResponseHeader>
</Header>
<Body>
<ns2:ResponseData>
<ns2:Employee >
<ns2:MessageList xsi:type="ns3:Info">
<ns2:Message>
<ns4:Type>new</ns4:Type>
<ns4:Code>2</ns4:Code>
<ns4:Source>Emp</ns4:Source>
<ns4:Description>new hire</ns4:Description>
</ns2:Message>
</ns2:MessageList>
<ns2:MessageList xsi:type="ns3:Info">
<ns2:Message>
<ns4:Type>new</ns4:Type>
<ns4:Code>1</ns4:Code>
<ns4:Source>contract</ns4:Source>
<ns4:Description>new hire</ns4:Description>
</ns2:Message>
</ns2:MessageList>
</ns2:Employee>
</ns2:ResponseData>
</Body>
</Envelope>
你的输出包含'肥皂:Envelope'所以它需要有一些'的xmlns:SOAP = “...”'声明。 –
我的不好。肥皂前缀元素将被本地名称替换。所以这就是为什么它不是必需的。所以最终的愿望输出是。 – Mike
请编辑您的问题的代码示例以反映所需的输出。看来你也已经用一个可接受的解决方案发布了一个类似的问题,这个问题不同吗?如果是这样,为什么? –