【发布时间】:2013-04-12 16:26:41
【问题描述】:
我正在创建一个代理,在该代理中我正在创建一个使用 x-path 表达式从请求正文中获取数据的属性。我写的属性是:
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="ChannelURI" expression="//xs:ChannelURI" scope="default" type="STRING"/>
现在我已经调用了一个类中介,我正在向它传递这个属性的值。所以在我的班级调解员中,我写了
public String channelUriFromProp = String.valueOf(context.getProperty("ChannelURI"));
所以现在如果我将任何字符串值传递给 ChannelURI 属性,我可以在我的类中介字符串 channelUriFromProp 中获取该值。
但真正的问题是当我从请求中传递空值时
<body>
<p:OpenPublicationSession xmlns:p="http://www.openoandm.org/xml/ISBM/">
<!--Exactly 1 occurrence-->
<xs:ChannelURI xmlns:xs="http://www.openoandm.org/xml/ISBM/"></xs:ChannelURI>
</p:OpenPublicationSession>
</body>
然后当我在类中介代码中打印 channelUriFromProp 的值时,我得到
<xs:ChannelURI xmlns:xs="http://www.openoandm.org/xml/ISBM/"/>
而不是获取 null 或空。我在这里做错了什么? 提前致谢。
【问题讨论】: