Changes:
- Change the behaviour of
defaultPolicyto inherit the settings of
a previous policy even if it does not inheritDefaultXmlSerializationPolicy.
In rare cases this changes the behaviour (where a custom policy was
originally set (with different defaults), it didn't inherit the
default policy, and it is now replaced by a default policy). - In XmlWriter introduce a
safeCdsectfunction that will handle embedded end
of cdata sequences by splitting the CDATA section into two sections. This is
now used in serialization to avoid serialization errors if the value contains
]]>.
Fixes:
- Fix serialization of cdata in the generic (and Android) xml writer. The writer
incorrectly escaped entities in cdata (#304), and did not correctly deal with
]]>in the cdata content (this is resolved by writing as two separate cdata
sections). - Make the default instance encodeToString (
XML.encodeToString) use the
regular behaviour for handling null prefixes. This fixes the default empty
prefix being used if none is manually set (rather than the annotated prefix). - Fix attributes not being prefixed with a namespace if their namespace prefix
is the default prefix for that namespace. As a workaround leave the prefix
different from its containers. - In pedantic mode, allow an
XmlSerialNameto use thexmlprefix as long as
its namespace is left default or maps to the xml namespace. Also force the
prefix used to be the standard prefix (although, depending on the xml writer
this may already be the case effectively). - For the generic parser / serializer make handling of newline/tabs in attribute
values standard compliant (#300). This means that when writing all will be
written as character entities to allow for preservation of the values. For
reading the entities are just resolved. Actual newline/tab content in
attribute values is normalized as space characters (where CRLF is still
replaced by a single space). As attribute values can be differen types than
CData this does not further normalize the value by collapsing whitespace
sequences.