Releases: pdvrieze/xmlutil
Releases Β· pdvrieze/xmlutil
1.0.0-rc2 β Tweak it up
Features:
- Add additional shortcut encodeToStream and decodeFromStream functions
that provide direct access to streams (similar to the serialization-io
support for sinks/sources). - Add support for resolving elements with ID attributes to
XML.XMLInput.
This still requires a custom (de)serializer. - Add a new
XmlDeclModeconstant (IfRequired) that will write a minimal
declaration for XML 1.1, but not for XML 1.0.
Changes:
- Change the entry point for configuration to
XML.v1instead of
XML1_0(it is deprecated, to be removed in the final 1.0 release).
It should be noted thatXML.recommended,XML.fastand their
versioned equivalents are also available.
Fixes:
- Reading unknown entities is now checked in various cases (and no longer read
as an empty string) - Fix some errors in handling ID attributes (
@XmlIDannotation). - Fix some issues with writing of xml declarations in XML 1.0 mode.
1.0.0-rc1 β Wow, it is getting to be time
Please note this release has removed most deprecated code. Also note that the
configuration system is redesigned (the old approach still works but is deprecated).
Features:
- Add
decodeToSequenceanddecodeWrappedToSequencefunctions that allow
decoding to a sequence. This can be either wrapped or unwrapped (or wrapped
externally). - Add
decodeToSequenceFromSourceetc. functions for kotlinx.io sources for
cross platform use without having to manually create an xml reader.
Changes:
- Change the recommended method for configuring the format. The constructor that
takes a configuration function as parameter is now deprecated to be replaced
by a factory function that names the configuration chosen: recommended_1_0,
fast_1_0, compat, etc. This avoids multiple configuration layers being needed. - Update to kotlin 2.3.0-RC2, updating the api version to 2.3 to enable return
value checking (kotlinx.serialization requires this too) - The DOM implementation is streamlined and refactored. There are some bug
fixes and more importantly API changes. This should lead to an overall
better experience using dom with existing DOM implementations (JS/Java) - Remove most deprecated code (some over 5 years old), but introduce a
few more new deprecations for poor APIs that were not deprecated (or
internal) yet. - Introduce a new annotation for implementations of
XmlSerializer:
(@XmlDynamicNameMarker). This annotation being present on a type triggers
full two-pass serialization for serialization configured with
isCollectingNSAttributes=true. This has been set on the relevant serializers
in the library (compact fragment, qname, node, element), but would also
be valid set on a regular (non-custom container). - When compact fragments are serialized it will now omit namespace attributes
if they are already declared on a higher level (and not overridden).
Fixes:
- Fix threadsafety for LayeredFormatCache by making defensive copy on write
when the cache is updated. - Fix the root prefix being ignored if the element has already been cached
with a different prefix (this is not semantically relevant in the XML, but
not expected). See #315. - Fix collecting of namespace attributes in the root (#315) for dynamic/custom
serializer content, by using type annotation to ensure the full 2-pass
approach.
0.91.3
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.
0.91.2
Features:
- Make
defaultPrimitiveOutputKindanddefaultObjectOutputKind
configurable attributes rather than (overridable) properties (#285). - Allow the "xml" prefix in annotations to be used without explicit
namespace specification, but implicitly mapped to the xml namespace:
http://www.w3.org/XML/1998/namespace. Note that while not enforced
it is not valid to declare the prefix to have any different value.
Adresses #289.
Changes:
- Tidy up the implementation of the constructors of the
DefaultSerializationPolicy. This might have slight consequences
in binary compatibility for (experimental) inheritance. - Change
DelegatingSerializer(in serialutil) to take the serial
name as parameter as using the delegate is not valid.
Fixes:
- Fix trimming of strings inside a mixed context where there is an
@XmlIgnoreSpace(true)annotation. - Fix handling of entity references in handling generic value holders
(node, compactFragment). This addresses bug #291 with two separate,
but equivalent errors.
0.91.1
Features:
- Add an annotation
@XmlMapEntryNameto force map entries not to be
collapsed, also specifying the name of the entry. - Improve translation of serial names to xml names in the
default policy (strip out text after '<', '[' and '(')
Changes:
- Replace
@XmlNamespaceDeclSpecwith@XmlNamespaceDeclSpecsthat
accepts an array argument - Synchronize annotation and readme docs #279 (thanks to Jack Boswell
(boswelja))
Fixes:
- Fix deserialization of value classes that wrap a string when inside
an@XmlValueproperty (#280). - Fix the issue that the for JavaScript overloads cannot be different
only in external parameter type. This breaks compiling with a
js2025 target. Discussed in #83. - Inspired by #274, fix the decoding of non-collapsed map entries
where theXmlSerialNameannotation is not present. - Further fixes on inline serialization with more cases.
0.91.0
Features:
- Add
XmlKeyNameas annotation to set the name of the key used in
maps. This just adds the capability to the default policy. Supports
issue #218. - Add (and change in the recommended policy) the isXmlFloat property
that ensures properties are stored in XML format (for infinity).
Decoding will accept both formats. Fixes #222.
Fixes:
- Fix #269 to allow
@XmlValueforCompactFragmentto capture the
contents of an element while allowing attributes to be captured. It
should be noted that combining this with element children is not
intended to be supported (it may work if the tagsoup is trailing). - Fix caching issue in case of polymorphic elements (at least in lists)
where the polymorphic descriptor did not retain use side annotations,
thus resulting in invalid cache keys.
0.91.0-RC1
Features:
- Add a core-io and serialization-io modules that support using kotlinx.io
- Add inline function shortcuts for encodeToString/decodeFromString with
prefix/qname parameter that also take their serializer from the type
parameter instead of as explicit parameter. - Support both the default polymorphic serializer and handling unknown
elements broadly, in particular inside value items (as list). #256.
For handling unknown values the implementation now attempts to detect
the unknown element handler not consuming the element and will in such
case parse the remaining elements (This uses input.location so the
reader must support that). - (Finally) support running in node (falling back to the generic
implementation rather than the dom implementation). Note that this
does not inject a DOM implementation, so DOM handling will not work
unless an alternative compatible implementation is already present. - The cache feature has been improved: it is now a proper LRU cache;
it has better key matching (more matches) - Add further inline shortcuts for encodeToString that take
tagname/prefix parameters. - Implement handling of whitespace preservation, including handling
the attribute cascading to child tags. Types can now specify their
own defaults.
Changes:
- Build with Kotlin 2.1.10
- Fix smart attribute writing to not use the null prefix for a
non-null namespace (even when bound to the null-namespace).
Attributes with null prefix are always in the null namespace. - Build with Kotlin 2.1.0. This means that except for
core-android
the other-androidartefacts are now deprecated. They are separate
synthetic configurations that only forward dependencies. encodeToWriterwill now flush the writer. This is particularly
relevant in the context ofOutputStreamWriterthat doesn't write
content until flushed or closed.- Serialization no longer loads jdk/android specific modules for
parsing (when loaded they will be used in creating serializers/parsers) - getElementsByTagName(Ns) now supports wildcards (*)
Fixes:
- Make getElementsByTagName(Ns) return all descendents (not only children)
per the DOM standard #265. - Don't detect end of cdata (incorrectly) inside a string #266.
- Make recovery work more broadly, including handling text/cdata #253.
- Make defaultSerializer work #256.
- Fixed cache keys (this caused inefficiency and memory leaks #264). The
memory leaks are also addressed using an LRU cache. - When parsing text with entity content don't mark initial/trailing
whitespace as ignorable, even when the result is parsed as
separate events. Fixes #241. - When creating a default cache doesn't work, fall back to not
caching (#255). - Some work to handle the misconfiguration of multiple types with
equalSerialNamein the same context leading to invalid cache
hits (#254) - Various fixes to handling of
xml:spaceand@XmlIgnoreWhitespace. Note
that xml:space="preserve" in a document overrides handling for all
children. xml:space="default" gets back to default handling. Types
by default inherit their whitespace handling from their owners. When
the@XmlIgnoreWhitespaceannotation is presented, this will change
the default for that type/element and its members. - Fix automatic prefix generation for attributes (was an infinite
loop: #251). Make it reuse existing prefixes if present rather than
write a new prefix. If reuse is not desirable, explicitly declare
the prefixes on the element using@XmlNamespaceDeclSpec - Fix (make consistent) the handling of
@XmlChildrenNamewhen the
namespace attribute is left out/default (#252). It would use the
empty/null namespace rather than the behaviour ofXmlSerialName
which defaults to the namespace of the parent tag. The behaviour
is now consistent. For those cases where the original behaviour
is needed, just specify the namespace explitly to be the empty
string.
0.90.3 β All at the same time
Changes:
- In pedantic mode check that xml/xmlns are not used as names (they
are always invalid). Note that namespaces can be specified using
@XmlSerialName(for tags) and@XmlNamespaceDeclSpec(for
additional names). - The cache to use can now be configured. By default it uses the
threadLocal version, but the thread unsafe default is also available,
as is theFormatCache.Dummycache that does no caching.
Fixes:
- Fix support for multiple namespaces inside a single tag (QNameMap)
as reported in #249. - Use threadlocals for caching document structures by default. This should avoid
multithreading issues when reusing the format (recommended for speed)
0.90.2 Mooor Rocketpower!
Changes:
- Update to Kotlin 2.0.21 / Kotlinx.serialization 1.7.3
- Add support for Android native targets (@whyoleg in #242)
And all changes from 0.90.2-beta1:
Changes:
- Update to Kotlin 2.0.20 / kotlinx.serialization 1.7.2
- Extensive optimization of decoding (serialization), parsing
(KtXmlReader) including the creation of the xmlDescriptors. - Add a new preset
fastfor a config/policy that chooses speed over
verification (such as element order). It still requires "correct"
xml files. - Add "work in progress" xml schema module to the dev branch. This
is not yet ready for release (but will parse most xml schemas) - Have the XmlReader.{version,standalone,encoding} properties be
retained by all readers (as existing parsers behave); reading these
values before the document declaration was seen (or known to not be
present) is non-deterministic. - Make the value of the
depthproperty ofXmlReaderconsistent
for EndElement values. The depth of an endEvent uses the android
XmlPullParser semantics - In the case of a polymorphic value child (or list of polymorphic
children as value child), when an unknown tag is encountered, allow
this to be matched against a single!XmlSerializerfrom the module.
This aids #225. - Capture format parsing errors in XmlParsingException #228
Fixes:
- Fix siblingsToFragment for native/js so that it terminates on end of
stream, even if this doesn't include DocumentEnd event. - Make
@XmlValuework with regular types (to support generic parsing
of element content of variable type, some including mixed/text content)
β probably also fixes #238. - Better support
@XmlSerialNamewhere value (localname) is defaulted.
Change this behaviour to actually use the same algorithm as normally
(not using the FQCN). - More reluctant caching of extended type descriptors such that type
parameters work correctly with caching. - Fix NodeSerializer in the serialization module to properly forward
to the actual implementation. - Don't make the companion of
XmlDeclModeinternal (#219). This is a
workaround for a regresion in 2.0 that doesn't allow resolving enum
constants in this case. - Fix deserialization with contextual serializer #220
- Fix
NamespaceHolder.namespacesAtCurrentDepthfor nested
declarations. - Fix infinite recursion issue with xmlStreaming.newWriter / newReader
0.90.2-beta1 Rocket power!
Changes:
- Extensive optimization of decoding (serialization), parsing
(KtXmlReader) including the creation of the xmlDescriptors. - Add a new preset
fastfor a config/policy that chooses speed over
verification (such as element order). It still requires "correct"
xml files. - Add "work in progress" xml schema module to the dev branch. This
is not yet ready for release (but will parse most xml schemas) - Have the XmlReader.{version,standalone,encoding} properties be
retained by all readers (as existing parsers behave); reading these
values before the document declaration was seen (or known to not be
present) is non-deterministic. - Make the value of the
depthproperty ofXmlReaderconsistent
for EndElement values. The depth of an endEvent uses the android
XmlPullParser semantics - In the case of a polymorphic value child (or list of polymorphic
children as value child), when an unknown tag is encountered, allow
this to be matched against a single!XmlSerializerfrom the module.
This aids #225.
Fixes:
- Fix NodeSerializer in the serialization module to properly forward
to the actual implementation. - Don't make the companion of
XmlDeclModeinternal (#219). This is a
workaround for a regresion in 2.0 that doesn't allow resolving enum
constants in this case. - Fix deserialization with contextual serializer #220
- Fix
NamespaceHolder.namespacesAtCurrentDepthfor nested
declarations.