我正在尝试使用以下内容编写soap消息:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">使用XOM。
我正在使用以下命令创建元素
Element soap = new Element("soap:Envelope", "http://schemas.xmlsoap.org/soap/envelope/");但是我不知道如何添加xmlns:xsi和xmln:xsd属性。使用
Attribute xsi = new Attribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");返回以下错误
Attribute objects are not used to represent namespace declarations那么如何添加这些属性呢?
谢谢
发布于 2011-10-07 23:32:00
XOM和其他基于树的包应该根据您为元素和属性定义的名称空间URI(可能还有前缀)自动添加所需的名称空间声明。那么,为什么要显式地添加它们呢?这不管用吗?
https://stackoverflow.com/questions/7688250
复制相似问题