提问人:Mansi Kale 提问时间:8/4/2023 最后编辑:kjhughesMansi Kale 更新时间:8/4/2023 访问量:64
元素“X:element”的前缀“X”未绑定
The prefix "X" for element "X:element" is not bound
问:
我收到此错误:
TypeError: The prefix "types" for element "types:ReceiveMessageResponse" is not bound.
at com.orchestral.rhapsody.modules.standard.filters.executescript.ExecuteScript.doProcessMessage(ExecuteScript.java:9)
使用此代码:
var next = output.append(input[0]);
var output =
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/ xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/ xmlns:tns=http://www.show.scot.nhs.uk/sci/gateway/messaging2.0 xmlns:types=http://www.show.scot.nhs.uk/sci/gateway/messaging2.0 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema'>
<soap:Body soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<types:ReceiveMessageResponse>
<ReceiveMessageResult href="#id1"/>
</types:ReceiveMessageResponse>
<types:GatewayAck id="id1" xsi:type="types:GatewayAck">
<Code xsi:type="xsd:int">0</Code>
<Detail xsi:type="xsd:string"/>
<Source xsi:type="xsd:string"/>
<UserMsg xsi:type="xsd:string"/>
</types:GatewayAck>
</soap:Body>
</soap:Envelope>
next.xml = output;
我尝试再创建一个标签,但没有成功。Types
答:
-1赞
kjhughes
8/4/2023
#1
命名空间前缀,例如必须声明。例如,添加以下声明:types
xmlns:types="http://example.com/types"
文档/消息中的任何公共祖先元素都会将所有带前缀的组件放在命名空间中。types
http://example.com/types
更新:根据 @Quentin 的鹰眼,声明就在那里,但许多命名空间 URL 没有正确用引号分隔:
改变
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/
xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/
xmlns:tns=http://www.show.scot.nhs.uk/sci/gateway/messaging2.0
xmlns:types=http://www.show.scot.nhs.uk/sci/gateway/messaging2.0
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns:xsd=http://www.w3.org/2001/XMLSchema'>
自
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:tns='http://www.show.scot.nhs.uk/sci/gateway/messaging2.0'
xmlns:types='http://www.show.scot.nhs.uk/sci/gateway/messaging2.0'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
注意正确分隔所有命名空间 URL。
评论
0赞
Quentin
8/4/2023
他们有。他们只是打错了字。
1赞
kjhughes
8/4/2023
@Quentin:Arg,你说得对。我在页面内搜索了它,但由于水平滚动而错过了它。答案已更新。谢谢。
评论
attributeName='value' otherAttributeName='otherValue'
attributeName='value otherAttributeName=otherValue'
xmlns:types