首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Jdom读取xml文件

使用Jdom读取xml文件
EN

Stack Overflow用户
提问于 2015-04-03 18:58:35
回答 1查看 473关注 0票数 1

我正在尝试用JDOM浏览xml文件。下面是xml文件:

代码语言:javascript
复制
 <?xml version="1.0"  encoding= "UTF-8" ?> 
<definitions name="Web Service Mediation"
targetNamespace="http://these-info.univ-tun.com/Web Service Mediation" 
xmlns="http://these-info.univ-tun.comstem online" >
<binding name="ConnTWS" type="wsdlns:SimplePortType">
<soap:binding   style="rpc"  transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="soap">
<soap:operation soapAction="http://tempuri.org/action/binding.ConnTWS"/>
</operation>
</binding>  
</definitions> 

但是当我运行.java类时,我会遇到以下错误:

代码语言:javascript
复制
org.jdom.input.JDOMParseException: Error on line 6 of document file:/C:/Users/samsung/Desktop/copie%20de%20workspace/PluginFinal/plugin/eclipsehelio%20avec%20atl%20-%20Copie/workspace/Jdom2/Grammaire.xml: The prefix "soap" for element "soap:binding" is not bound.
    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:465)
    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:810)
    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:789)
    at JDOM.main(JDOM.java:24)
Caused by: org.xml.sax.SAXParseException: The prefix "soap" for element "soap:binding" is not bound.

任何人都可以帮助更正xml文件。非常感谢。

EN

回答 1

Stack Overflow用户

发布于 2015-04-03 19:04:44

您尚未声明soap命名空间。将xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"添加到定义属性中。如下所示:

代码语言:javascript
复制
<definitions name="Web Service Mediation"
 targetNamespace="http://these-info.univ-tun.com/Web Service Mediation" 
 xmlns="http://these-info.univ-tun.comstem online" 
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29430886

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档