当前位置: 首页 > news >正文

金华网站建设公司招聘重庆官网seo分析

金华网站建设公司招聘,重庆官网seo分析,柳州网站建设源码,邢台做网站多少钱很多老系统,特别是C的系统,可能数据结构采用的xml。xml对java来说没有什么,但是C来说,可能还有个顺序问题,毕竟c没有那么多通用类库。 2 xstream 先说依赖,我本来不想升级,但是有个问题卡者就给…

很多老系统,特别是C++的系统,可能数据结构采用的xml。xml对java来说没有什么,但是C++来说,可能还有个顺序问题,毕竟c++没有那么多通用类库。
2 xstream
先说依赖,我本来不想升级,但是有个问题卡者就给升了,虽然升了并没有解决我的问题。

     <!-- xstream 升级到1.4.18后 依赖的jar --><dependency><groupId>com.thoughtworks.xstream</groupId><artifactId>xstream</artifactId><version>1.4.20</version></dependency><dependency><groupId>xmlpull</groupId><artifactId>xmlpull</artifactId><version>1.1.3.4d_b4_min</version></dependency><dependency><groupId>xpp3</groupId><artifactId>xpp3_min</artifactId><version>1.1.4c</version></dependency>

2.1 双下划线问题
看下面注释

    public static String toXml(Object obj) {
//        XStream xstream = new XStream(new DomDriver(encoding));XStream xstream = new XStream(new Xpp3Driver(new NoNameCoder())); // 解决xml双下划线的问题//            XStream xstream=new XStream(new DomDriver()); //直接用jaxp dom来解释//            XStream xstream=new XStream(new DomDriver("utf-8")); //指定编码解析器,直接用jaxp dom来解释//如果没有这句,xml中的根元素会是<包.类名>;或者说:注解根本就没生效,所以的元素名就是类的属性xstream.processAnnotations(obj.getClass()); //通过注解方式的,一定要有这句话return xstream.toXML(obj);}

2.2 复杂对象转换的问题
一般的复杂结构还不会有问题,但是老式的默认却不行,很奇怪。

com.thoughtworks.xstream.converters.ConversionException: 
---- Debugging information ----
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : COMMON_FPKJ_XMXX
class               : com.whty.einv.sks.model.params.req.body.ReqInvoiceIssueBody026Bean
required-type       : com.whty.einv.sks.model.params.req.body.ReqInvoiceIssueBody026Bean
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path                : /business/REQUEST_COMMON_FPKJ/COMMON_FPKJ_XMXXS
line number         : 32
class[1]            : com.whty.einv.sks.model.params.req.business.ReqInvoiceIssue026Bean
required-type[1]    : com.whty.einv.sks.model.params.req.business.ReqInvoiceIssue026Bean
version             : 1.4.20
-------------------------------at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81)at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72)at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:68)at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:499)at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:425)at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:277)at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:74)at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72)at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:68)at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:52)at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:136)at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1464)at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1441)at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1321)at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1312)at com.whty.einv.sks.model.util.XmlUtil.toBean(XmlUtil.java:53)at com.whty.einv.sks.model.test.TestJavaToXml.toBean(TestJavaToXml.java:108)at com.whty.einv.sks.model.test.TestJavaToXml.test10_026(TestJavaToXml.java:86)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)at org.junit.runners.ParentRunner.run(ParentRunner.java:363)at org.junit.runner.JUnitCore.run(JUnitCore.java:137)at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: COMMON_FPKJ_XMXXat com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:81)at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125)at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55)at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125)at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88)at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125)at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:79)at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125)at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:74)at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125)at com.thoughtworks.xstream.mapper.SecurityMapper.realClass(SecurityMapper.java:71)at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125)at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:47)at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:420)at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:277)at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:74)... 40 moreProcess finished with exit code -1

.1 jibx实现
先看依赖,使用这个技术比较麻烦一点,就是再打包的时候要执行mvn jibx:bind

  <dependency><groupId>org.jibx</groupId><artifactId>jibx-run</artifactId><version>1.3.1</version></dependency><dependency><groupId>org.jibx</groupId><artifactId>jibx-extras</artifactId><version>1.3.1</version><scope>test</scope></dependency><dependency><groupId>org.jibx</groupId><artifactId>jibx-tools</artifactId><version>1.3.1</version><scope>test</scope></dependency>

再看打包

<build><plugins><!-- 源码插件 --><plugin><artifactId>maven-source-plugin</artifactId><version>2.1</version><configuration><attach>true</attach></configuration><executions><execution><phase>compile</phase><goals><goal>jar</goal></goals></execution></executions></plugin><plugin><groupId>org.jibx</groupId><artifactId>jibx-maven-plugin</artifactId><version>1.3.1</version><configuration><schemaBindingDirectory>src/main/resources</schemaBindingDirectory><includeSchemaBindings><!-- 每次执行前需要先mvn clean compile test-compile或手动删除Jibx生成的文件,再执行mvn jibx:bind,有相同类名时,一次性会执行失败  --><!-- jibx生成的所有类文件会位于第一个生成的类的同目录下,分开执行可以在不同的文件夹生成对应类 --><includeSchemaBindings>binding/request/*-binding.xml</includeSchemaBindings><includeSchemaBindings>binding/response/*-binding.xml</includeSchemaBindings></includeSchemaBindings><verbose>true</verbose></configuration><executions><execution><goals><goal>bind</goal></goals></execution></executions></plugin></plugins><resources><resource><directory>src/main/java</directory><includes><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource><resource><directory>src/main/resources</directory><includes><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource></resources></build>

使用如下

	/*** obj转xml** @param obj* @param indent 格式化缩进* @return String* @throws JiBXException*/public static String toXml(Object obj, int indent) throws JiBXException {IBindingFactory bfact = BindingDirectory.getFactory(obj.getClass());IMarshallingContext mctx = bfact.createMarshallingContext();mctx.setIndent(indent);StringWriter writer = new StringWriter();mctx.marshalDocument(obj, encoding, null, writer);return writer.toString();}/*** xml转obj** @param xml* @param clazz* @return* @throws JiBXException*/public static <T> T fromXml(String xml, Class<T> clazz) throws JiBXException {IBindingFactory bfact = BindingDirectory.getFactory(clazz);IUnmarshallingContext uctx = bfact.createUnmarshallingContext();Object obj = uctx.unmarshalDocument(new StringReader(xml), null);return clazz.cast(obj);}
http://www.hkea.cn/news/174070/

相关文章:

  • 哈 做网站网店代运营收费
  • 制作网页的三大技术是什么郑州seo顾问
  • 网站建设报价流程行业网站网址
  • 提供邯郸做wap网站网页推广方案
  • 网站从域名广告营销公司
  • 网站链接的常见形式免费广告网
  • 微信微网站开发教程百度大数据平台
  • 网站服务设计引流推广是什么意思
  • 学校网站建设管理办法本周新闻热点事件
  • 网站移动版怎么做网站创建公司
  • wordpress 微商城模板下载地址苏州seo推广
  • 珠海网站哪家好百度com百度一下你
  • wordpress wp.net网络优化工程师是做什么的
  • 刷会员网站怎么做外贸如何推广
  • 专做女装的网站网站备案是什么意思
  • 没有网站可以做seo排名吗小学生简短小新闻摘抄
  • 做程序网站需要什么代码宁波seo搜索排名优化
  • 网站建设开发语言新冠病毒最新消息
  • 怎么做1688网站网页制作工具有哪些
  • 一个网站的主题和设计风格最好用的免费建站平台
  • 网站开发主页手机优化游戏性能的软件
  • 怎么做属于自己的域名网站网络策划方案
  • destoon做的网站百度商务合作联系
  • 金山区网站制作网络营销策划书1500字
  • 厦门网站建设制作工具熊猫关键词挖掘工具
  • 徐州网站建设 网站推广百度首页快速排名系统
  • 在线转格式网站怎么做拼多多seo 优化软件
  • 成都理工疫情最新消息贵港seo
  • 网站如何防止攻击怎么自己做一个小程序
  • 企业网站建设英文百度收录