Skip to content

Releases: pdvrieze/xmlutil

1.0.0-rc2 – Tweak it up

18 Jan 20:49

Choose a tag to compare

Pre-release

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 XmlDeclMode constant (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.v1 instead of
    XML1_0 (it is deprecated, to be removed in the final 1.0 release).
    It should be noted that XML.recommended, XML.fast and 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 (@XmlID annotation).
  • Fix some issues with writing of xml declarations in XML 1.0 mode.

1.0.0-rc1 – Wow, it is getting to be time

23 Dec 17:03

Choose a tag to compare

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 decodeToSequence and decodeWrappedToSequence functions that allow
    decoding to a sequence. This can be either wrapped or unwrapped (or wrapped
    externally).
  • Add decodeToSequenceFromSource etc. 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

28 Oct 15:00

Choose a tag to compare

Changes:

  • Change the behaviour of defaultPolicy to inherit the settings of
    a previous policy even if it does not inherit DefaultXmlSerializationPolicy.
    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 safeCdsect function 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 XmlSerialName to use the xml prefix 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

28 Jul 19:02

Choose a tag to compare

Features:

  • Make defaultPrimitiveOutputKind and defaultObjectOutputKind
    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

15 May 13:51

Choose a tag to compare

Features:

  • Add an annotation @XmlMapEntryName to 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 @XmlNamespaceDeclSpec with @XmlNamespaceDeclSpecs that
    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 @XmlValue property (#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 the XmlSerialName annotation is not present.
  • Further fixes on inline serialization with more cases.

0.91.0

01 Apr 12:04

Choose a tag to compare

Features:

  • Add XmlKeyName as 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 @XmlValue for CompactFragment to 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

04 Mar 14:29

Choose a tag to compare

0.91.0-RC1 Pre-release
Pre-release

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 -android artefacts are now deprecated. They are separate
    synthetic configurations that only forward dependencies.
  • encodeToWriter will now flush the writer. This is particularly
    relevant in the context of OutputStreamWriter that 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
    equal SerialName in the same context leading to invalid cache
    hits (#254)
  • Various fixes to handling of xml:space and @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 @XmlIgnoreWhitespace annotation 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 @XmlChildrenName when the
    namespace attribute is left out/default (#252). It would use the
    empty/null namespace rather than the behaviour of XmlSerialName
    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

07 Nov 12:06

Choose a tag to compare

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 the FormatCache.Dummy cache 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!

15 Oct 19:26

Choose a tag to compare

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 fast for 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 depth property of XmlReader consistent
    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! XmlSerializer from 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 @XmlValue work with regular types (to support generic parsing
    of element content of variable type, some including mixed/text content)
    – probably also fixes #238.
  • Better support @XmlSerialName where 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 XmlDeclMode internal (#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.namespacesAtCurrentDepth for nested
    declarations.
  • Fix infinite recursion issue with xmlStreaming.newWriter / newReader

0.90.2-beta1 Rocket power!

22 Jul 18:00

Choose a tag to compare

Pre-release

Changes:

  • Extensive optimization of decoding (serialization), parsing
    (KtXmlReader) including the creation of the xmlDescriptors.
  • Add a new preset fast for 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 depth property of XmlReader consistent
    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! XmlSerializer from 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 XmlDeclMode internal (#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.namespacesAtCurrentDepth for nested
    declarations.