dom4j:Adding text to an XML document must not be null

在使用dom4j组装xml时,出现如下错误:

org.apache.cxf.interceptor.Fault: Adding text to an XML document must not be null
	at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
	at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
	at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)
	at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:68)
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalArgumentException: Adding text to an XML document must not be null
	at org.dom4j.DocumentFactory.createText(DocumentFactory.java:174)
	at org.dom4j.tree.AbstractElement.addText(AbstractElement.java:899)
	at org.dom4j.tree.AbstractElement.setText(AbstractElement.java:1120)
	at com.dyst.tippe.util.XMLUtils.genQueryResponseXmlFor04C01(XMLUtils.java:132)
	at com.dyst.tippe.service.impl.PunishProxyServiceHelper.handle(PunishProxyServiceHelper.java:95)
	at com.dyst.tippe.service.impl.PunishProxyServiceImpl.queryObjectOut(PunishProxyServiceImpl.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy12.queryObjectOut(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
	... 32 more


解决:每一个element的test值都需要判断,建议写成方法

StringUtil类:

public static String replaceNullString(String str){
	if(str == null ) return "";
           else return str;
}


 


 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
Your Excel Survival Kit: Your Guide to Surviving and Thriving in an Excel world By 作者: Anne Walsh ISBN-10 书号: 161547045X ISBN-13 书号: 9781615470457 出版日期: 2016-06-01 pages 页数: 160 You have just been promoted into a job that requires more Excel skills than ever. You are floundering, drowning in a sea of spreadsheets. This book walks you through in an easy accessible way—vlookups, pivot tables, Power Query, and Power Pivot. The Excel Survival Kit is small enough to slip into your purse. Introduction Who This Book Is For What This Book Covers Typographical Conventions and Special Elements Chapter 1-Back to Basics:What Do You Know Already? Data Entry Tips and Tricks Dropping Your Dread of Formulas Getting to Know the Common Excel Functions Understanding the Copying Functions Roling inthe Wortkshets Rolling in the Worksheets rTinting in Excel Charts,Charts,Charts Keyboard Navigation ummay Chapter 2 Getting Your Data Together:Catching Your File Creating a Spreadsheet List from Scratch Getting Data from a Data Dump Sorting and Filtering Summary Chapter 3 Further Cleaning,Slicing,and Dicing Removing/Completing Blank Columns/Rows/Cells Cleaning,Combining,and Amending Existing Data Extracting Specific Pieces of Data from a Cell to Refine a Data Using the lferrorO Function Summary Chapter 4 The VlookupO Function:An Excel Essential Understanding the Vlookup) Function Syntax Troubleshooting VlookupO:Dealina with #N/A Understanding When to Use VlookupO How to Solve Common VlookupO Problems summay Chapter 5 Creating Pivot Tables Assembling Data for a Pivot Table Creating Your First Pivot Table Understanding Summarize Values By Tidying Up the Numbers in a Pivot Table Refreshing Data in a Pivot Table Grouping by Dates Grouping by Amounts Showing Values As Using Report Filters Setting Up Slicers (but Only if You Have Excel 2010 or Later) Chanaing pivot Table 1avout Changing Pivot lable Layout Ac0lng a alL Adding Conditional Formatting Troubleshooting Pivot Tables summary Chapter 6 Using Power Query to Quickly Clean Up Data Cleaning Up an Accounting Data Dump Converting Unpivoted Data to a Pivoted Format Creating a Query in Power Query to Merge Data Sets Summary Chapter 7 Beyond the Pivot Table:Power Pivot Instaling and Locating Power Pivot Before You Start Using Power Pivot Gettina Your Data into Power Pivot Linking the Data Sets Together Creating a pivot Table from the Creating a Pivot Table from the Combined Data Recommended Resources ummay Appendix Data Validation Techniques Restricting Number Sizes Restricting Date Entries Restricting Text pages 页数 Extending Data Validation Applying Data Validation to Another Part of a Sheet Identifying Duplicate Entries in a List Simple Normalization(Getting Crossways Data to Go

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值