Skip to content

Commit eebd098

Browse files
committed
Add javadoc
1 parent 371fda9 commit eebd098

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

src/main/java/com/fasterxml/jackson/dataformat/xml/XmlFactoryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class XmlFactoryBuilder extends TSFBuilder<XmlFactory, XmlFactoryBuilder>
5555
protected String _nameForTextElement;
5656

5757
/**
58-
* Set a default value in case of empty an empty element (empty XML tag)
58+
* Set a default value in case of an empty element (empty XML tag)
5959
*<p>
6060
* Value used for pseudo-property used for returning empty XML tag.
6161
* Defaults to empty String, but may be changed.

src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ public Builder nameForTextElement(String name) {
104104
return this;
105105
}
106106

107+
/**
108+
*
109+
* Set a default value in case of an empty element (empty XML tag)
110+
*<p>
111+
* In case of an empty XML tag (like `<no-content/>`) the serialized value
112+
* is set to `String value`. If not specified, the default value is empty String.
113+
*
114+
* @since 2.17
115+
*/
107116
public Builder valueForEmptyElement(String value) {
108117
_mapper.setValueForEmptyElement(value);
109118
return this;

src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public class FromXmlParser
4040
*/
4141
public final static String DEFAULT_UNNAMED_TEXT_PROPERTY = "";
4242

43+
/**
44+
* The default value placeholder for XML empty tag is an empty
45+
* String ("").
46+
*/
4347
public final static String DEFAULT_EMPTY_ELEMENT_VALUE = "";
4448

4549
/**
@@ -286,6 +290,9 @@ public FromXmlParser(IOContext ctxt, int genericParserFeatures, int xmlFeatures,
286290
this(ctxt, genericParserFeatures, xmlFeatures, codec, xmlReader, tagProcessor, FromXmlParser.DEFAULT_EMPTY_ELEMENT_VALUE);
287291
}
288292

293+
/**
294+
* @since 2.17
295+
*/
289296
public FromXmlParser(IOContext ctxt, int genericParserFeatures, int xmlFeatures,
290297
ObjectCodec codec, XMLStreamReader xmlReader, XmlNameProcessor tagProcessor, String valueForEmptyElement)
291298
throws IOException

src/main/java/com/fasterxml/jackson/dataformat/xml/deser/XmlTokenStream.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public class XmlTokenStream
120120
*/
121121
protected String _textValue;
122122

123-
protected String _valueForEmptyElement;
123+
protected final String _valueForEmptyElement;
124124

125125
/**
126126
* Marker flag set if caller wants to "push back" current token so
@@ -558,7 +558,6 @@ private final int _next() throws XMLStreamException
558558

559559
/**
560560
* @return Collected text, if any, EXCEPT that if {@code FromXmlParser.Feature.EMPTY_ELEMENT_AS_NULL}
561-
* OR {@code FromXmlParser.Feature.EMPTY_ELEMENT_AS_EMPTY_ARRAY}
562561
* AND empty element, returns {@code null}
563562
*/
564563
private final String _collectUntilTag() throws XMLStreamException

0 commit comments

Comments
 (0)