javax.xml

JDK 10 cannot import javax.xml.namespace in Eclipse

夙愿已清 提交于 2020-01-24 18:00:24
问题 It's very strange. I am moving a dynamic web project from Java 8 to Java 10. The last thing I cannot get the dependency resolved is the javax.xml.namespace.QName class. You can see in the attached screen shot, the QName class exist in JRE System Library, but the IDE keep complaining that QName cannot be resolved to a type. 回答1: Try to change the order of elements on your classpath. The JRE must be before the Maven Dependencies. That fixes the issue. My guess is that the Java 10 compiler

parse method in DocumentBuilder is returning an error

一世执手 提交于 2019-12-25 06:25:29
问题 I am trying to use the parse method that takes an InputSource to parse a DocumentBuilder instance. The error is: The method parse(InputStream) in the type DocumentBuilder is not applicable for the arguments (InputSource) This is the code: public static Document loadXMLFromString(String xml) throws Exception { DocumentBuilder factory = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = factory.parse(new InputSource(new StringReader(xml))); } It is asking me to change to

parse method in DocumentBuilder is returning an error

拈花ヽ惹草 提交于 2019-12-25 06:25:27
问题 I am trying to use the parse method that takes an InputSource to parse a DocumentBuilder instance. The error is: The method parse(InputStream) in the type DocumentBuilder is not applicable for the arguments (InputSource) This is the code: public static Document loadXMLFromString(String xml) throws Exception { DocumentBuilder factory = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = factory.parse(new InputSource(new StringReader(xml))); } It is asking me to change to

How to use javax.xml.transform.stax in Android Studio?

久未见 提交于 2019-12-11 07:33:58
问题 I'm running into a strange problem in Android Studio. I'm also using latest JDK. I can't seem to import the following : javax.xml.stream javax.xml.transform.stax They both are unavailable and I don't know why. In a non android project I'm able to import these. Any clue why these are missing in android? If not, the simple solution is that I added these dependencies from maven. But after running I'm getting this error: "Ill-advised or mistaken usage of a core class (java.* or javax.*) when not

Prevent XXE (External Entity Processing) Attack with JAXB + Spring RESTful Web Services

本小妞迷上赌 提交于 2019-12-07 21:59:50
问题 I know that we can prevent the XXE attack by setting the property IS_SUPPORTING_EXTERNAL_ENTITIES in the abstract class XMLInputFactory to false in JAXB. I have also seen this stackoverflow answer. My question here is, How do I create a instance of XMLInputFactory and set this IS_SUPPORTING_EXTERNAL_ENTITIES property to false when the spring application loads up. And that particular XMLInputFactory instance should only be used for all the JAXB conversion for all the classes that uses javax

I want to use XQuery For Xml processing in java

二次信任 提交于 2019-12-07 05:23:42
问题 I want to use XQuery for fetching data from Xml in java, but I am not getting which Jar I need to add for this. I searched in google lot but haven't got any useful example. For example I got following link: https://docs.oracle.com/database/121/ADXDK/adx_j_xqj.htm Then I am not getting jar file mentioned here. Anyone know how to start using XQuery in Java with a simple example will be very helpful. After lot of search I have got this link which is saying Xqjapi.jar comes with oracle database.

Prevent XXE (External Entity Processing) Attack with JAXB + Spring RESTful Web Services

▼魔方 西西 提交于 2019-12-06 11:21:57
I know that we can prevent the XXE attack by setting the property IS_SUPPORTING_EXTERNAL_ENTITIES in the abstract class XMLInputFactory to false in JAXB. I have also seen this stackoverflow answer . My question here is, How do I create a instance of XMLInputFactory and set this IS_SUPPORTING_EXTERNAL_ENTITIES property to false when the spring application loads up. And that particular XMLInputFactory instance should only be used for all the JAXB conversion for all the classes that uses javax.xml.bind.annotation package. Spring uses RequestMappingHandlerAdapter which is an

While validating against XSD, find the exact missing element in the XML using any of DOM, StAX, SAX parsers

和自甴很熟 提交于 2019-12-02 16:40:20
问题 I have a XML file and its corresponding XSD file. While validating using StAX parser, I've attached an error handler. Basically, I encounter two types of errors in a well-formed XML file. 1) Incorrect type of data inside an element, for e.g string inside an element that is supposed to have an integer. 2) Missing element: An element that must be present according to XSD is not present in the XML. Using a StAX parser and custom error handler, I'm able to rectify the first type of error. But for