jaxp

在Java / Maven中处理“Xerces hell”?

时光总嘲笑我的痴心妄想 提交于 2020-05-01 15:48:50
问题: In my office, the mere mention of the word Xerces is enough to incite murderous rage from developers. 在我的办公室里,仅仅提到Xerces这个词就足以煽动开发者的凶悍愤怒。 A cursory glance at the other Xerces questions on SO seem to indicate that almost all Maven users are "touched" by this problem at some point. 粗略地看一眼其他Xerces关于SO的问题似乎表明,几乎所有Maven用户都会在某个时候“触及”这个问题。 Unfortunately, understanding the problem requires a bit of knowledge about the history of Xerces... 不幸的是,理解这个问题需要对Xerces的历史有一点了解...... History 历史 Xerces is the most widely used XML parser in the Java ecosystem. Xerces是Java生态系统中使用最广泛的XML解析器。 Almost every library

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

JAXP Transformer via DOMSource returns stylesheet

时间秒杀一切 提交于 2020-02-02 11:37:51
问题 I'm having a strange problem and can't seem to find any solution. I'm simply trying to apply an XSLT stylesheet to an XML file (in this case, SPARQL query results formatted as XML, but any other XML file gives the same result). In this case, I need to create the transformer by re-using an already loaded XML document, via DOMSource. You can find the code below (simplified; normally, the stylesheet document comes from elsewhere): TransformerFactory factory = TransformerFactory.newInstance();

JAXP Transformer via DOMSource returns stylesheet

邮差的信 提交于 2020-02-02 11:36:05
问题 I'm having a strange problem and can't seem to find any solution. I'm simply trying to apply an XSLT stylesheet to an XML file (in this case, SPARQL query results formatted as XML, but any other XML file gives the same result). In this case, I need to create the transformer by re-using an already loaded XML document, via DOMSource. You can find the code below (simplified; normally, the stylesheet document comes from elsewhere): TransformerFactory factory = TransformerFactory.newInstance();

Trying to use XInclude with Java and resolving the fragment with xml:id

a 夏天 提交于 2020-01-24 20:00:12
问题 I've been trying to get XInclude working in my XML document and finally have it working in Oxygen XML, which I'm using to author the XML documents. I then went to my app, written in Java, but it doesn't seem to support any form of XPointer resolution except using something like: element(/1/2). This is, obviously, an awful scheme to have to use since every time the document is edited the XPointer needs changing to reflect the new position of the node in the XML! The scheme I had working simply

Java/XSD parsing

泄露秘密 提交于 2020-01-01 09:28:12
问题 I doubt if there is something like this but I thought to ask though: Does anyone know if there is a library in Java that reads an xsd file and "creates" the defined elements e.g. in a String format to use in the code? E.g. read in the following schema: <?xml version="1.0" encoding="utf-8"?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Address"> <xs:complexType> <xs:sequence> <xs:element name="Street" type="xs:string" /> <xs:element

Unable to find a factory for http://www.w3.org/2001/XMLSchema

余生颓废 提交于 2019-12-25 16:57:13
问题 I'm having some annoying problems with the following code, that worked okay until switched to Java 1.7 import javax.xml.validation.SchemaFactory; SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Running from Netbeans with -Djaxp.debug=1, the following error is thrown: The above snipped code is part of an OSGI bundle JAXP: using thread context class loader (sun.misc.Launcher$AppClassLoader@5e3a78ad) for search JAXP: Looking up system property 'javax.xml

JAXP parse error on valid XML

做~自己de王妃 提交于 2019-12-24 10:28:53
问题 I am trying to run some XPath Queries on XML in Java and apparently the recommended way to do so is to construct a document first. Here is the standard JAXP code sample that I was using: import org.w3c.dom.Document; import javax.xml.parsers.*; final DocumentBuilder xmlParser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); final Document doc = xmlParser.parse(xmlFile); I also tried the Saxon API, but got the same errors: import net.sf.saxon.s9api.*; final DocumentBuilder