Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Jackson JAXB Annotations Source Code
Jackson JAXB Annotations Source Code files are provided in the source packge (jackson-module-jaxb-annotations-2.14.0-sources.jar). You can download it at Jackson Base module Maven Website.
You can also browse Jackson JAXB Annotations Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/module/jaxb/deser/DomElementJsonDeserializer.java
package com.fasterxml.jackson.module.jaxb.deser;
import java.io.IOException;
import java.util.Iterator;
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.Element;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.node.ArrayNode;
/**
* @author Ryan Heaton
*
* @deprecated Since 2.10 not used
*/
@Deprecated // since 2.10 -- not used anywhere?
public class DomElementJsonDeserializer
extends StdDeserializer<Element>
{
private static final long serialVersionUID = 1L;
private final DocumentBuilder builder;
public DomElementJsonDeserializer()
{
super(Element.class);
try {
DocumentBuilderFactory bf = DocumentBuilderFactory.newInstance();
bf.setNamespaceAware(true);
// [modules-base#84]: add secure processing settings
bf.setExpandEntityReferences(false);
builder = bf.newDocumentBuilder();
try {
bf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
} catch(Exception e) {
// not necessarily supported by all implementations
}
} catch (ParserConfigurationException e) {
throw new RuntimeException();
}
}
public DomElementJsonDeserializer(DocumentBuilder b)
{
super(Element.class);
builder = b;
}
@Override
public Element deserialize(JsonParser p, DeserializationContext ctxt) throws IOException
{
Document document = builder.newDocument();
JsonNode n = p.readValueAsTree();
return fromNode(p, document, n);
}
protected Element fromNode(JsonParser p, Document document, JsonNode jsonNode)
throws IOException
{
String ns = jsonNode.get("namespace") != null ? jsonNode.get("namespace").asText() : null;
String name = jsonNode.get("name") != null ? jsonNode.get("name").asText() : null;
if (name == null) {
throw JsonMappingException.from(p, "No name for DOM element was provided in the JSON object.");
}
Element element = document.createElementNS(ns, name);
JsonNode attributesNode = jsonNode.get("attributes");
if (attributesNode != null && attributesNode instanceof ArrayNode) {
Iterator<JsonNode> atts = attributesNode.elements();
while (atts.hasNext()) {
JsonNode node = atts.next();
ns = node.get("namespace") != null ? node.get("namespace").asText() : null;
name = node.get("name") != null ? node.get("name").asText() : null;
String value = node.get("$") != null ? node.get("$").asText() : null;
if (name != null) {
element.setAttributeNS(ns, name, value);
}
}
}
JsonNode childsNode = jsonNode.get("children");
if (childsNode != null && childsNode instanceof ArrayNode) {
Iterator<JsonNode> els = childsNode.elements();
while (els.hasNext()) {
JsonNode node = els.next();
name = node.get("name") != null ? node.get("name").asText() : null;
String value = node.get("$") != null ? node.get("$").asText() : null;
if (value != null) {
element.appendChild(document.createTextNode(value));
}
else if (name != null) {
element.appendChild(fromNode(p, document, node));
}
}
}
return element;
}
}
⏎ com/fasterxml/jackson/module/jaxb/deser/DomElementJsonDeserializer.java
Or download all of them as a single archive file:
File name: jackson-module-jaxb-annotations-2.14.0-sources.jar File size: 27411 bytes Release date: 2022-11-05 Download
⇒ jackson-core-2.2.3.jar - Jackson
2022-05-03, ∼7500🔥, 1💬
Popular Posts:
What Is wstx-asl-3.2.8.jar? wstx-asl-3.2.8.jar is JAR file for the ASL component of Woodstox 3.2.8. ...
Apache BCEL Source Code Files are inside the Apache BCEL source package file like bcel-6.5.0-src.zip...
maven-model-builder-3.5. 4.jaris the JAR file for Apache Maven 3.5.4 Model Builder module. Apache Ma...
ZooKeeper is a centralized service for maintaining configuration information, naming, providing dist...
JDK 17 jdk.localedata.jmod is the JMOD file for JDK 17 Localedata module. JDK 17 Locale Data module ...