No such namespace prefix: soap12 is in scope on: org.dom4j.tree.DefaultElement
来源:互联网 发布:网络虚拟礼物 编辑:程序博客网 时间:2024/06/01 09:26
org.dom4j.IllegalAddException: No such namespace prefix:
这个异常是说:要添加的这个元素的前缀,没有声明!这主要是在添加元素时直接用上级元素的allElement方法时出现的。例:
这个异常是说:要添加的这个元素的前缀,没有声明!这主要是在添加元素时直接用上级元素的allElement方法时出现的。例:
Element ns1 = rootTarget.addElement("soap12:Body");
有两种解决方式:
第一种:新建一个Element,加上前缀声名后再添加到父元素上去。
Element soap12= org.log4j.documentHelper.createElement("soap12:Body");soap12.add(new Namespace("soap12","http://www.w3.org/2001/XMLSchema"));rootTarget.add(soap12);
第二种:直接在根上声名:然后就可以用addElement方法去添加结点了。
Element root = DocumentHelper.createElement("soap12:Envelope").addAttribute("xmlns:soap12","http://www.w3.org/2003/05/soap-envelope").addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").addAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); root.addNamespace("soap12", "http://www.w3.org/2001/XMLSchema");Document document = DocumentHelper.createDocument(root); Element body = root.addElement("soap12:Body");
阅读全文
1 0
- No such namespace prefix: soap12 is in scope on: org.dom4j.tree.DefaultElement
- org.nutz.dao.DaoException: Need non-arg constructor : class org.dom4j.tree.DefaultElement
- org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog.
- org.dom4j.DocumentException: Content is not allowed in prolog. 解决办法
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- Attribute is missing the Android namespace prefix
- no such file or directory: Prefix.pch'
- org.dom4j.DocumentException: no protocol
- org.dom4j.DocumentException: no protocol
- org.dom4j.DocumentException: no protocol
- Keepalived安装与配置
- JavaScript从入门到放弃(1)-基本操作:String,Object,Array,map,set
- Oracle01
- (备忘录)图表嵌入(1)
- osgEarth脚本属性案例 9. feature_labels_script.earth
- No such namespace prefix: soap12 is in scope on: org.dom4j.tree.DefaultElement
- jdbcTemplate查询返回对象或集合
- ios进行版本更新提示
- python---删除链表中的元素
- JVM内存解密【转】
- 算法学习之路:分治策略-归并排序-java实现
- php利用curl爬虫爬取微信公众号,防止ip封锁
- JAVA进阶之XML及AJAX
- 【转载】A lightweight distributed task scheduling framework.(分布式任务调度平台XXL-JOB)