将 XML 命名空间前缀替换为完整的命名空间 URI 值?
Replace XML namespace prefix with full namespace URI value?
为了详细说明这个问题,我可以用定义替换名称空间定义吗?
这还合式吗XML?它们是 "same" 上下文中的第二个仍然是格式正确的 SOAP XML 消息,与原始消息一样。
例如,
这是来自 Oracle 示例的格式良好的 SOAP XML 消息。然后我将复制它,但将 SOAP-ENV
属性替换为其定义:
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
所以SOAP-ENV
被引用的定义"http://schemas.xmlsoap.org/soap/envelope/"
替换了
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<http://schemas.xmlsoap.org/soap/envelope/:Header/>
<http://schemas.xmlsoap.org/soap/envelope/:Body>
<http://schemas.xmlsoap.org/soap/envelope/:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail>
</http://schemas.xmlsoap.org/soap/envelope/:Fault>
</http://schemas.xmlsoap.org/soap/envelope/:Body>
</http://schemas.xmlsoap.org/soap/envelope/:Envelope>
不,您建议的用命名空间 URI 替换命名空间前缀的语法格式不正确 XML。不过,有些软件支持的东西接近:
<{http://schemas.xmlsoap.org/soap/envelope/}Envelope />
这通常被称为Clark Notation。
为了详细说明这个问题,我可以用定义替换名称空间定义吗?
这还合式吗XML?它们是 "same" 上下文中的第二个仍然是格式正确的 SOAP XML 消息,与原始消息一样。
例如,
这是来自 Oracle 示例的格式良好的 SOAP XML 消息。然后我将复制它,但将 SOAP-ENV
属性替换为其定义:
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
所以SOAP-ENV
被引用的定义"http://schemas.xmlsoap.org/soap/envelope/"
替换了
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<http://schemas.xmlsoap.org/soap/envelope/:Header/>
<http://schemas.xmlsoap.org/soap/envelope/:Body>
<http://schemas.xmlsoap.org/soap/envelope/:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail>
</http://schemas.xmlsoap.org/soap/envelope/:Fault>
</http://schemas.xmlsoap.org/soap/envelope/:Body>
</http://schemas.xmlsoap.org/soap/envelope/:Envelope>
不,您建议的用命名空间 URI 替换命名空间前缀的语法格式不正确 XML。不过,有些软件支持的东西接近:
<{http://schemas.xmlsoap.org/soap/envelope/}Envelope />
这通常被称为Clark Notation。