You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-19Lines changed: 19 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ reading and writing [XML](http://en.wikipedia.org/wiki/Xml) encoded data.
6
6
Further, the goal is to emulate how [JAXB](http://en.wikipedia.org/wiki/JAXB) data-binding works
7
7
with "Code-first" approach (no support is added for "Schema-first" approach).
8
8
Support for JAXB annotations is provided by [JAXB annotation module](https://github.com/FasterXML/jackson-modules-base/tree/master/jaxb);
9
-
this module provides low-level abstractions (`JsonParser`, `JsonGenerator`, `JsonFactory`) as well as small number of higher level
9
+
this module provides low-level abstractions (`JsonParser`, `JsonGenerator`, `JsonFactory`) as well as a small number of higher level
10
10
overrides needed to make data-binding work.
11
11
12
12
It is worth noting, however, that the goal is NOT to be full JAXB clone; or to be a
@@ -16,8 +16,8 @@ Specifically:
16
16
17
17
* While XML serialization should ideally be similar to JAXB output, deviations are not automatically considered flaws (there are reasons for some differences)
18
18
* What should be guaranteed is that any XML written using this module must be readable using module as well ("read what I wrote"): that is, we do aim for full round-trip support
19
-
* From above: there are XML constructs that module will not be able to handle; including some cases JAXB (and other Java XML libraries) supports
20
-
* This module also support constructs and use cases JAXB does not handle: specifically, rich type and object id support of Jackson are supported.
19
+
* From above: there are XML constructs that this module will not be able to handle; including some cases JAXB (and other Java XML libraries) support
20
+
* This module also supports constructs and use cases JAXB does not handle: specifically, rich type and object id support of Jackson are supported.
(or whatever version is most up-to-date at the moment)
72
72
73
-
Also: you usually also want to make sure that XML library in use is [Woodstox](https://github.com/FasterXML/woodstox) since it is not only faster than Stax implementation JDK provides, but also works better and avoids some known issues like adding unnecessary namespace prefixes.
73
+
Also: you usually also want to make sure the XML library in use is [Woodstox](https://github.com/FasterXML/woodstox) since it is not only faster than Stax implementation JDK provides, but also works better and avoids some known issues like adding unnecessary namespace prefixes.
74
74
You can do this by adding this in your `pom.xml`:
75
75
76
76
Maven:
@@ -91,9 +91,9 @@ dependencies {
91
91
92
92
# Usage
93
93
94
-
Although module implements low-level (`JsonFactory` / `JsonParser` / `JsonGenerator`) abstractions,
95
-
most usage is through data-binding level. This because a small number of work-arounds have been added
96
-
at data-binding level, to work around XML peculiarities: that is, stream of `JsonToken`s that parser
94
+
Although this module implements low-level (`JsonFactory` / `JsonParser` / `JsonGenerator`) abstractions,
95
+
most usage is through data-binding level. This is because a small number of work-arounds have been added
96
+
at data-binding level, to work around XML peculiarities: that is, the stream of `JsonToken`s that the parser
97
97
produces has idiosyncracies that need special handling.
98
98
99
99
Usually you either create `XmlMapper` simply by:
@@ -102,7 +102,7 @@ Usually you either create `XmlMapper` simply by:
102
102
XmlMapper mapper =newXmlMapper();
103
103
```
104
104
105
-
but in case you need to configure settings, you will want to use Builder (added in
105
+
but in case you need to configure settings, you will want to use the Builder (added in
In addition to standard [Jackson annotations](https://github.com/FasterXML/jackson-annotations) and optional JAXB (`javax.xml.bind.annotation`), this project also adds couple of its own annotations for convenience, to support XML-specific details:
244
+
In addition to standard [Jackson annotations](https://github.com/FasterXML/jackson-annotations) and optional JAXB (`javax.xml.bind.annotation`), this project also adds a couple of its own annotations for convenience, to support XML-specific details:
245
245
246
246
*`@JacksonXmlElementWrapper` allows specifying XML element to use for wrapping `List` and `Map` properties
247
247
*`@JacksonXmlProperty` allows specifying XML namespace and local name for a property; as well as whether property is to be written as an XML element or attribute.
248
248
*`@JacksonXmlRootElement` allows specifying XML element to use for wrapping the root element (default uses 'simple name' of the value class)
249
249
*`@JacksonXmlText` allows specifying that value of one property is to be serialized as "unwrapped" text, and not in an element.
250
250
*`@JacksonXmlCData` allows specifying that the value of a property is to be serialized within a CData tag.
251
251
252
-
for longer description, check out [XML module annotations](https://github.com/FasterXML/jackson-dataformat-xml/wiki/Jackson-XML-annotations).
252
+
for a longer description, check out [XML module annotations](https://github.com/FasterXML/jackson-dataformat-xml/wiki/Jackson-XML-annotations).
253
253
254
254
## Known Limitations
255
255
@@ -269,7 +269,7 @@ Currently, following limitations exist beyond general Jackson (JSON) limitations
269
269
* Lists and arrays are "wrapped" by default, when using Jackson annotations, but unwrapped when using JAXB annotations (if supported, see below)
270
270
*`@JacksonXmlElementWrapper.useWrapping` can be set to 'false' to disable wrapping
271
271
*`JacksonXmlModule.setDefaultUseWrapper()` can be used to specify whether "wrapped" or "unwrapped" setting is the default
272
-
* Polymorphic Type Handling works, but only some of inclusion mechanisms are supported (`WRAPPER_ARRAY`, for example is not supported due to problems wrt mapping of XML, Arrays)
272
+
* Polymorphic Type Handling works, but only some inclusion mechanisms are supported (`WRAPPER_ARRAY`, for example is not supported due to problems with reference to mapping of XML, Arrays)
273
273
* JAXB-style "compact" Type Id where property name is replaced with Type Id is not supported.
274
274
* Mixed Content (elements and text in same element) is not supported in databinding: child content must be either text OR element(s) (attributes are fine)
275
275
* While XML namespaces are recognized, and produced on serialization, namespace URIs are NOT verified when deserializing: only local names are matched
0 commit comments