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/ser/DomElementJsonSerializer.java
package com.fasterxml.jackson.module.jaxb.ser;
import java.io.IOException;
import java.lang.reflect.Type;
import org.w3c.dom.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
/**
* @deprecated Since 2.10 not used
*/
@Deprecated // since 2.10 -- not used anywhere?
public class DomElementJsonSerializer
extends StdSerializer<Element>
{
private static final long serialVersionUID = 1L;
public DomElementJsonSerializer() { super(Element.class); }
@Override
public void serialize(Element value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
jgen.writeStartObject();
jgen.writeStringField("name", value.getTagName());
if (value.getNamespaceURI() != null) {
jgen.writeStringField("namespace", value.getNamespaceURI());
}
NamedNodeMap attributes = value.getAttributes();
if (attributes != null && attributes.getLength() > 0) {
jgen.writeArrayFieldStart("attributes");
for (int i = 0; i < attributes.getLength(); i++) {
Attr attribute = (Attr) attributes.item(i);
jgen.writeStartObject();
jgen.writeStringField("$", attribute.getValue());
jgen.writeStringField("name", attribute.getName());
String ns = attribute.getNamespaceURI();
if (ns != null) {
jgen.writeStringField("namespace", ns);
}
jgen.writeEndObject();
}
jgen.writeEndArray();
}
NodeList children = value.getChildNodes();
if (children != null && children.getLength() > 0) {
jgen.writeArrayFieldStart("children");
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
switch (child.getNodeType()) {
case Node.CDATA_SECTION_NODE:
case Node.TEXT_NODE:
jgen.writeStartObject();
jgen.writeStringField("$", child.getNodeValue());
jgen.writeEndObject();
break;
case Node.ELEMENT_NODE:
serialize((Element) child, jgen, provider);
break;
}
}
jgen.writeEndArray();
}
jgen.writeEndObject();
}
// Improved in 2.3; was missing from 2.2
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
throws JsonMappingException
{
if (visitor != null) {
visitor.expectStringFormat(typeHint);
}
}
@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
throws JsonMappingException
{
// Since 2.3: should be more like String type really, not structure
return createSchemaNode("string", true);
}
}
⏎ com/fasterxml/jackson/module/jaxb/ser/DomElementJsonSerializer.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, ∼7429🔥, 1💬
Popular Posts:
What is the sax\Writer.java provided in the Apache Xerces package? I have Apache Xerces 2.11.0 insta...
JDK 11 java.xml.jmod is the JMOD file for JDK 11 XML (eXtensible Markup Language) module. JDK 11 XML...
JDK 17 java.compiler.jmod is the JMOD file for JDK 17 Compiler module. JDK 17 Compiler module compil...
Apache Ant Source Code Files are inside the Apache Ant source package file like apache-ant-1.10.10-s...
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...