public enum Xml2JsonOptions extends Enum<Xml2JsonOptions>
Enum Constant and Description |
---|
CONVERT_ATTRIBUTES
Will attempt to convert attribute values as well as elements.
|
CONVERT_ATTRIBUTES_MATCH_NAMESPACE
Will attempt to convert attribute values as well as elements, ignoring
all attributes that do not have the same namespace as the element they
belong to (includes null namespaces).
|
UNQUOTED_FIELD_NAMES
If enabled, field names will not be quoted.
|
USE_XSI_TYPE
If enabled, the converter will look for an
xsi:type
attribute (type in XML Schema Instance namespace), and
apply the following rules:
If the attribute value begins with "xsd:", and the portion after
the ":" is one of the XSD primitive numeric or boolean types, the
element's value will be emitted without quotes. |
WRAP_WITH_PARENS
If enabled, the entire string is wrapped by parentheses.
|
Modifier and Type | Method and Description |
---|---|
static Xml2JsonOptions |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Xml2JsonOptions[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Xml2JsonOptions CONVERT_ATTRIBUTES
Attributes are converted as if they were child elements, but will appear in the output before any children. The order of attributes is undefined (per XML spec).
Warning:: If an attribute has the same name as a child element, both will be emitted in the output. When that JSON is then processed by JavaScript, the second value will overwrite the first (although ugly, this behavior is consistent with the other converters).
If an element has attributes but no children, the element's text content (if any) will be ignored.
If the attribute has a namespace prefix, that prefix will be dropped in the output (it is an invalid JSON fieldname). If multiple attributes have the same local name but different prefixes, they will all be emitted in the output (but only one will surving being read back in).
public static final Xml2JsonOptions CONVERT_ATTRIBUTES_MATCH_NAMESPACE
See CONVERT_ATTRIBUTES
for additional rules and caveats.
public static final Xml2JsonOptions UNQUOTED_FIELD_NAMES
eval()
doesn't require quoted names either).public static final Xml2JsonOptions USE_XSI_TYPE
xsi:type
attribute (type
in XML Schema Instance namespace), and
apply the following rules:
BeanConverter
, preserving knowledge
about the bean structure.public static final Xml2JsonOptions WRAP_WITH_PARENS
eval()
.
Note that the resulting string is not acceptable to Json2XmlConverter
.public static Xml2JsonOptions[] values()
for (Xml2JsonOptions c : Xml2JsonOptions.values()) System.out.println(c);
public static Xml2JsonOptions valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null