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 Dataformat XML Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson also allows you to parse or generate XML messages with the Jackson Dataformat XML Extension.
Jackson Dataformat XML Source Code files are provided in the source packge (jackson-dataformat-xml-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Dataformat XML Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/dataformat/xml/deser/XmlDeserializationContext.java
package com.fasterxml.jackson.dataformat.xml.deser;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.DefaultDeserializationContext;
import com.fasterxml.jackson.databind.deser.DeserializerCache;
import com.fasterxml.jackson.databind.deser.DeserializerFactory;
/**
* XML-specific {@link DeserializationContext} needed to override certain
* handlers.
*
* @since 2.12
*/
public class XmlDeserializationContext
extends DefaultDeserializationContext
{
private static final long serialVersionUID = 1L;
/*
/**********************************************************
/* Life-cycle methods
/**********************************************************
*/
/**
* Default constructor for a blueprint object, which will use the standard
* {@link DeserializerCache}, given factory.
*/
public XmlDeserializationContext(DeserializerFactory df) {
super(df, null);
}
private XmlDeserializationContext(XmlDeserializationContext src,
DeserializationConfig config, JsonParser p, InjectableValues values) {
super(src, config, p, values);
}
private XmlDeserializationContext(XmlDeserializationContext src) { super(src); }
private XmlDeserializationContext(XmlDeserializationContext src, DeserializerFactory factory) {
super(src, factory);
}
private XmlDeserializationContext(XmlDeserializationContext src, DeserializationConfig config) {
super(src, config);
}
@Override
public XmlDeserializationContext copy() {
return new XmlDeserializationContext(this);
}
@Override
public DefaultDeserializationContext createInstance(DeserializationConfig config,
JsonParser p, InjectableValues values) {
return new XmlDeserializationContext(this, config, p, values);
}
@Override
public DefaultDeserializationContext createDummyInstance(DeserializationConfig config) {
// need to be careful to create non-blue-print instance
return new XmlDeserializationContext(this, config);
}
@Override
public DefaultDeserializationContext with(DeserializerFactory factory) {
return new XmlDeserializationContext(this, factory);
}
/*
/**********************************************************
/* Overrides we need
/**********************************************************
*/
@Override // since 2.12
public Object readRootValue(JsonParser p, JavaType valueType,
JsonDeserializer<Object> deser, Object valueToUpdate)
throws IOException
{
// 18-Sep-2021, tatu: Complicated mess; with 2.12, had [dataformat-xml#374]
// to disable handling. With 2.13, via [dataformat-xml#485] undid this change
if (_config.useRootWrapping()) {
return _unwrapAndDeserialize(p, valueType, deser, valueToUpdate);
}
if (valueToUpdate == null) {
return deser.deserialize(p, this);
}
return deser.deserialize(p, this, valueToUpdate);
}
// To support case where XML element has attributes as well as CDATA, need
// to "extract" scalar value (CDATA), after the fact
@Override // since 2.12
public String extractScalarFromObject(JsonParser p, JsonDeserializer<?> deser,
Class<?> scalarType)
throws IOException
{
// Only called on START_OBJECT, should not need to check, but JsonParser we
// get may or may not be `FromXmlParser` so traverse using regular means
String text = "";
while (p.nextToken() == JsonToken.FIELD_NAME) {
// Couple of ways to find "real" textual content. One is to look for
// "XmlText"... but for that would need to know configuration. Alternatively
// could hold on to last text seen -- but this might be last attribute, for
// empty element. So for now let's simply hard-code check for empty String
// as marker and hope for best
final String propName = p.currentName();
JsonToken t = p.nextToken();
if (t == JsonToken.VALUE_STRING) {
if (propName.equals("")) {
text = p.getText();
}
} else {
p.skipChildren();
}
}
return text;
}
}
⏎ com/fasterxml/jackson/dataformat/xml/deser/XmlDeserializationContext.java
Or download all of them as a single archive file:
File name: jackson-dataformat-xml-2.14.0-sources.jar File size: 98015 bytes Release date: 2022-11-05 Download
⇒ Download Jackson Dataformat Binary Packages
⇐ Jackson Dataformat Extensions
2021-10-10, ≈26🔥, 0💬
Popular Posts:
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...
Apache Log4j Core Implementation provides the functional components of the logging system. Users are...
JSP(tm) Standard Tag Library 1.1 implementation - Jakarta Taglibs hosts the Standard Taglib 1.1, an ...
JDK 11 java.sql.jmod is the JMOD file for JDK 11 SQL (Structured Query Language) module. JDK 11 SQL ...
What Is jms.jar? I heard it's related to JMS (Java Message Service) 1.1? The if you have an jms.jar ...