xerces

Java实现Base64编解码

眉间皱痕 提交于 2020-04-28 07:27:31
为什么要用Base64编码 在网络中传输数据都是使用ascii方式传输。对于一些图片、视频等数据,可能就会被编码成ascii中不可见部分的编码。网络中不同的路由设备处理方式不同,有可能就会把这部分数据弄丢了。为了保证数据传输的正确性,可以使用Base64编码将这些不可见数据编码成可见数据。 Java实现Base64编解码的几种方法 方法一 使用sun.misc包中的BASE64Encoder和BASE64Decoder类进行编解码。这种方式比较古老,不推荐使用。 代码如下: /** * sun.misc方式Base64编码 * @param str * @return */ public static String encodeBySunMisc(String str) { try { return new BASE64Encoder().encode(str.getBytes("UTF-8" )); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return "" ; } } /** * sun.misc方式Base64解码 * @param str * @return */ public static String decodeBySunMisc(String str) { try { byte

项目知识学习篇———数据清洗之kettle以及集成到java项目

久未见 提交于 2020-04-25 03:14:23
一、kettle工具下载 链接: https://pan.baidu.com/s/13Mx-QJkY-5dY-nDIpuZAzw 提取码: x146 pdi-ce-8.1.0.0.zip就是kettle软件 下载之后解压 进入文件夹根目录点击Spoon.bat就能开启客户端 二、kettle使用 1.需要连接上两个数据库 一个是你想要copy的库 还有一个是你自己的库 我这里是需要从一个oracle库拿到数据 然后放入到我这边的mysql数据库 2.右键DB连接 新建连接 3.我这里使用的是oracle和mysql需要两个连接包 在我网盘链接里有 ojdbc14-10.2.0.2.0.jar和mysql-connector-java-5.1.41.jar 拷贝放入到kettle的lib下上一步就可连接成功 4.然后就是两个库的关联映射 点击文件---新建----转换 将以下两个 表输入和插入/更新拖到转换之中 用shift将两个连接起来 效果如下 5.点击表输入 连接上你想要拷贝数据库的源数据库 获取sql语句就是查询你想要的表的数据 6.点击 插入更新 连接上你的本地数据库 浏览找到对应表 关联上两个表的唯一标示id 类似主键关联 kettle根据这个判断插入还是更新 然后下面关联上你想要更新的字段点确定就可以跑起来了 7.这样你就可以从一个库同步数据到你的库

Java类加载器ClassLoader总结

走远了吗. 提交于 2020-03-22 14:36:08
3 月,跳不动了?>>> JAVA类装载方式,有两种: 1.隐式装载, 程序在运行过程中当碰到通过new 等方式生成对象时,隐式调用类装载器加载对应的类到jvm中。 2.显式装载, 通过class.forname()等方法,显式加载需要的类 类加载的动态性体现: 一个应用程序总是由n多个类组成,Java程序启动时,并不是一次把所有的类全部加载后再运行,它总是先把保证程序运行的基础类一次性加载到jvm中,其它类等到jvm用到的时候再加载,这样的好处是节省了内存的开销,因为java最早就是为嵌入式系统而设计的,内存宝贵,这是一种可以理解的机制,而用到时再加载这也是java动态性的一种体现 java类装载器 JDK 默认提供了如下几种ClassLoader Bootstrp loader Bootstrp加载器是用C++语言写的,它是在Java虚拟机启动后初始化的,它主要负责加载 %JAVA_HOME%/jre/lib , -Xbootclasspath 参数指定的路径以及 %JAVA_HOME%/jre/classes 中的类。 ExtClassLoader Bootstrp loader加载ExtClassLoader,并且将ExtClassLoader的父加载器设置为Bootstrp loader.ExtClassLoader是用Java写的,具体来说就是 sun.misc

IllegalArgumentException: When using array of Objects as the value of SCHEMA_SOURCE property , no two Schemas should share the same targetNamespace

时光总嘲笑我的痴心妄想 提交于 2020-03-03 03:41:15
问题 I am using JasperReport/ireport4, I tried to generate a report as below public void fillReport() throws ParseException, groovyjarjarcommonscli.ParseException, IOException { try { Driver monDriver = new com.mysql.jdbc.Driver(); DriverManager.registerDriver(monDriver); connection = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/MyDB","", ""); Map mymap = new HashMap(); mymap.put("Title", MyTitle); mymap.put("legend", legend); mymap.put("SQL", Query()); FacesContext

IllegalArgumentException: When using array of Objects as the value of SCHEMA_SOURCE property , no two Schemas should share the same targetNamespace

爷,独闯天下 提交于 2020-03-03 03:40:06
问题 I am using JasperReport/ireport4, I tried to generate a report as below public void fillReport() throws ParseException, groovyjarjarcommonscli.ParseException, IOException { try { Driver monDriver = new com.mysql.jdbc.Driver(); DriverManager.registerDriver(monDriver); connection = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/MyDB","", ""); Map mymap = new HashMap(); mymap.put("Title", MyTitle); mymap.put("legend", legend); mymap.put("SQL", Query()); FacesContext

Java and Xerces: can't find property XMLConstants.ACCESS_EXTERNAL_DTD

主宰稳场 提交于 2020-02-25 06:36:38
问题 I looked for similar posts on this blog, but couldn't find an answer to my question, so I decided to ask for help. I wrote this simple function in Java: public void open(InputStream stream) throws FoliumFatalException { try { InputSource is = new InputSource(stream); DocumentBuilderFactory dfact = DocumentBuilderFactory.newInstance(); // /* OWASP: inhibit access to External Entities */ dfact.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); dfact.setAttribute(XMLConstants.ACCESS_EXTERNAL

Java and Xerces: can't find property XMLConstants.ACCESS_EXTERNAL_DTD

喜你入骨 提交于 2020-02-25 06:36:24
问题 I looked for similar posts on this blog, but couldn't find an answer to my question, so I decided to ask for help. I wrote this simple function in Java: public void open(InputStream stream) throws FoliumFatalException { try { InputSource is = new InputSource(stream); DocumentBuilderFactory dfact = DocumentBuilderFactory.newInstance(); // /* OWASP: inhibit access to External Entities */ dfact.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); dfact.setAttribute(XMLConstants.ACCESS_EXTERNAL

Integrate schema metatdata during XML Parsing with Xerces C++

空扰寡人 提交于 2020-01-26 02:29:48
问题 I want to parse an XML file and look up the datatype of attributes and entities in an XML schema file (.xsd) when I traverse the DOM. I found out that I can use the post schema validation infoset (PSVI) to get that information. For this I should be able to get a nodes info by the getFeature method: info = (xercesc::DOMPSVITypeInfo*) domNode->getFeature(xercesc::XMLUni::fgXercesDOMHasPSVIInfo, xercesc::XMLUni::fgVersion1_1); However I first seem to have to enable this feature. As there is no

Load my own Xalan implementation where an older Xalan is loaded to the parent classloader

别等时光非礼了梦想. 提交于 2020-01-22 02:24:07
问题 I'm writing a plugin for a framework that loads my code as a child classloader The problem is that that framework uses a certain Xerces version, that is not compatible with my code, I want to use my "own" jar for xerces, but it seems since the old one was already loaded, I can't seem to make my code use mine. I'm looking for some classloader seperation, I know it's a know problem, but can't seem to solve it Is there any framework, library, or code sample to user locally a newer jar in such a

Xerces-C validate xml with hardcoded xsd

梦想的初衷 提交于 2020-01-19 15:18:13
问题 I'm writing a library which takes xml files and parses them. To prevent users from feeding inalid xmls into my application i'm using xerces to validate the xml files via an xsd. However, i only manages to validate against xsd-files. Theoretically an user could just open this file and mess around with it. That's why i would like my xsd to be hardcoded in my library. Unfortunately i haven't found a way to do this with XercesC++, yet. That's how it is working right now... bool XmlParser: