Categories:
Audio (13)
Biotech (29)
Bytecode (35)
Database (77)
Framework (7)
Game (7)
General (512)
Graphics (53)
I/O (32)
IDE (2)
JAR Tools (86)
JavaBeans (16)
JDBC (89)
JDK (337)
JSP (20)
Logging (103)
Mail (54)
Messaging (8)
Network (71)
PDF (94)
Report (7)
Scripting (83)
Security (32)
Server (119)
Servlet (17)
SOAP (24)
Testing (50)
Web (19)
XML (301)
Other Resources:
Jackson Annotations Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Annotations Source Code files are provided in the source packge (jackson-annotations-2.12.4-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Annotations Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/databind/ext/DOMDeserializer.java
package com.fasterxml.jackson.databind.ext; import java.io.StringReader; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.xml.sax.InputSource; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.FromStringDeserializer; /** * Base for serializers that allows parsing DOM Documents from JSON Strings. * Nominal type can be either {@link org.w3c.dom.Node} or * {@link org.w3c.dom.Document}. */ public abstract class DOMDeserializer<T> extends FromStringDeserializer<T> { private static final long serialVersionUID = 1L; private final static DocumentBuilderFactory DEFAULT_PARSER_FACTORY; static { DocumentBuilderFactory parserFactory = DocumentBuilderFactory.newInstance(); // yup, only cave men do XML without recognizing namespaces... parserFactory.setNamespaceAware(true); // [databind#1279]: make sure external entities NOT expanded by default parserFactory.setExpandEntityReferences(false); // ... and in general, aim for "safety" try { parserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch(ParserConfigurationException pce) { // not much point to do anything; could log but... } catch (Error e) { // 14-Jul-2016, tatu: Not sure how or why, but during code coverage runs // (via Cobertura) we get `java.lang.AbstractMethodError` so... ignore that too } // [databind#2589] add two more settings just in case try { parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); } catch (Throwable t) { } // as per previous one, nothing much to do try { parserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); } catch (Throwable t) { } // as per previous one, nothing much to do DEFAULT_PARSER_FACTORY = parserFactory; } protected DOMDeserializer(Class<T> cls) { super(cls); } @Override public abstract T _deserialize(String value, DeserializationContext ctxt); protected final Document parse(String value) throws IllegalArgumentException { try { return documentBuilder().parse(new InputSource(new StringReader(value))); } catch (Exception e) { throw new IllegalArgumentException("Failed to parse JSON String as XML: "+e.getMessage(), e); } } /** * Overridable factory method used to create {@link DocumentBuilder} for parsing * XML as DOM. * * @since 2.7.6 */ protected DocumentBuilder documentBuilder() throws ParserConfigurationException { return DEFAULT_PARSER_FACTORY.newDocumentBuilder(); } /* /********************************************************** /* Concrete deserializers /********************************************************** */ public static class NodeDeserializer extends DOMDeserializer<Node> { private static final long serialVersionUID = 1L; public NodeDeserializer() { super(Node.class); } @Override public Node _deserialize(String value, DeserializationContext ctxt) throws IllegalArgumentException { return parse(value); } } public static class DocumentDeserializer extends DOMDeserializer<Document> { private static final long serialVersionUID = 1L; public DocumentDeserializer() { super(Document.class); } @Override public Document _deserialize(String value, DeserializationContext ctxt) throws IllegalArgumentException { return parse(value); } } }
⏎ com/fasterxml/jackson/databind/ext/DOMDeserializer.java
Â
⇒ Jackson Dataformat Extensions
⇠Jackson Data Binding Source Code
⇑ Downloading and Reviewing jackson-*.jar
⇑⇑ Jackson - Java JSON library
2022-02-19, 36180👍, 0💬
Popular Posts:
JDK 11 java.base.jmod is the JMOD file for JDK 11 Base module. JDK 11 Base module compiled class fil...
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...
Apache Log4j 1.2 Bridge allows applications coded to use Log4j 1.2 API to use Log4j 2 instead. Bytec...
JDK 11 jdk.internal.vm.compiler .jmodis the JMOD file for JDK 11 Internal VM Compiler module. JDK 11...
Jaxen, Release 1.1.1, is an open source XPath library written in Java. It is adaptable to many diffe...