Skip to content

Releases: pdvrieze/xmlutil

0.86.3 – Wasm it up

14 Dec 16:29
Compare
Choose a tag to compare

Changes:

  • The XmlStreaming object in core is replaced by an interface IXmlStreaming
    with an accessor function xmlStreaming that provides an appropriate
    instance. The platform specific objects have been retained, but deprecated.
    In various places extension functions have been added.
  • The KTOR module has been dropped from this release. As ktor officially supports
    the XML serialization using this library, please use the official ktor module.

Features:

  • Update to kotlinx.serialization 1.6.1, add wasmJs/wasmWasi support.
  • Support strict boolean parsing in policy
    (using xml schema rules allowing: 1, true, 0, false)
  • Add an alias XmlBoolean that parses according to xml rules independent of
    the policy.
  • Add versioned recommended configuration of the serializer. This provides
    for a stable configuration without manual configuration.
  • Add support for purely text lists as text content (similar to attributes).
    This comes with a textListDelimiters policy function that allows
    specifying delimiters (note that it will apply xml schema compatible
    collapsing of whitespace - as articles do).

Fixes:

  • Fix handling of empty textual value content.
  • Fix collapsing whitespace when it is empty #180.
  • Fix the way the recommended config works to apply the policy. Note that
    recommended is not designed to be stable.
  • Fix regression on root tag strictness. Now if the root type has a declared @XmlSerialName
    this type will be expected as the root tag unless explicitly specified differently
    as parameter.
  • Add a proper non-deprecated constructor for DefaultXmlSerializationPolicy
    this takes a Builder, or a configuration lambda. Both options enable
    future proofing when further attributes are added.
  • In the platform independent (native) DOM implementation allow
    comments outside the document element (rather than throwing an exception).
    Fixes #189.

0.86.2 – Don't trust them inputs

13 Sep 18:28
Compare
Choose a tag to compare

Security:

  • On JVM target only: explicitly disable creating input stream factory that
    allows for external entities (which could be local files such as passwd).
    An upgrade is recommended. However workarounds exist: Rather than use the
    convenience accessor from string, use the following code:
    XML.decodeFromReader(XmlStreaming.newGenericReader(inputString)) (or the
    relevant overloads - It is the usage of the generic reader that is key).

Features:

  • Support wildcard (*) for XmlBefore and XmlAfter. These create a
    partition in ordering. An element/attribute with wildcard before will
    be ordered before/after elements that do not have this. Explicit order
    relationships will be maintained.
  • Support checking ordering in reading.
  • Support ID type attributes with an @xmlid attribute marking them
  • Add support for strict attribute name matching (not allowing null namespace)
    matchup

Other:

  • Remove support for legacy JS in line with Kotlin 1.9 and kotlinx.serialization
    1.6.0

Fixes:

  • For attribute lists, make sure to collapse the whitespace.
  • When attributes have an @XmlSerialName annotation with a default namespace
    value, then this will result in a non-qualified attribute.
  • Fix nullable QName serialization (and probably other nullable inline-like)
    serialization.

0.86.1 – It's the little things

05 Jul 18:48
Compare
Choose a tag to compare

0.86.1

(July 5, 2023)

Features:

  • Support detecting duplicate elements outside of list context #145. This
    is not default behaviour as it is somewhat up to the serializer to deal
    with duplicate values, rather than the format.
  • Support wildcard (*) for XmlBefore and XmlAfter. These create a
    partition in ordering. An element/attribute with wildcard before will
    be ordered before/after elements that do not have this. Explicit order
    relationships will be maintained.
  • Support checking ordering in reading.
  • Update to Kotlinx.serialization 1.5.1
  • Add SerializableQName as an alias that links it to the serializer.
  • Add a helper function XmlSerializationPolicy.recoverNullNamespaceUse that
    can be used to support recovering in case of null namespaces (and them
    effectively functioning as wildcard)
  • Handle processing instructions correctly, expose processing instructions as
    target (XmlReader.piTarget) + data (XmlReader.piData) pairs
    attributes and XmlEvent.ProcessingInstructionEvent as event. (#160)
  • Allow processing instructions/whitespace as children of Native Document.

Fixes:

  • Fix recording/copying of attribute prefixes in copying algorithms (#167).
  • Fix reading/writing of processing instruction events (#160).
  • Fix recovery of element children (#160).
  • Fix decoding of nil elements in certain cases (lists) where the end of the tag
    wasn't parsed. Implemented decodeNull accordingly to actually finish the nil tag.
  • Fix accidental immediate emission of xsi:nil elements (rather than deferring
    as expected #152).
  • Add expected key name to the error message when it couldn't be found for a
    map. #140
  • Fix attribute name for empty prefix in Attr (native DOM). This should fix #142.

0.86.0 – Go in chunks

02 May 20:37
Compare
Choose a tag to compare

Features:

  • Preliminary (partial) support for chunked decoding/Chunked Decoder ()
  • Use kotlinx.serialization 1.5.0
  • The default policy now ignores all attributes in the xml namespace when
    found missing (it will not throw an exception). If explicitly declared
    they will still be handled.
  • Implement a FileReader and FileWriter (and streams) for native to allow
    native writing of files.
  • Update to Kotlin 1.8.21
  • Deprecate the ktor module (in favour of ktor's own xml integration module).
    Note that that module still uses xmlutil, it just provides its own xml access
    code.

Fixes:

  • Various high range unicode characters (and modifiers) were incorrectly seen
    as invalid values (relevant for emoji's)
  • Still allow for explicit xml:space properties (while also handling them
    automatically).
  • Update ChildCollector to use the correct/updated signature for
    polymorhpicDefaultDeserializer. "Fixes" #126 (the underlying issues are
    KT-55318
    and KT-56602)
  • Support document fragments in DomReader
  • Make the StAXReader not skip the StartDocument event initially.
  • Make XmlBufferedReader.nextTagEvent process/ignore StartDocument.
  • Made ignorable whitespace more consistent. #128
  • Fix handling of isCollectingNSAttributes (#135). This will now properly
    handle sealed polymorphism as well as deal properly with the default
    namespace: properties without prefix will not register the null namespace.
    If the default namespace is used anywhere, this ensures that prefixes are
    used otherwise. This will avoid all occurences of xmlns="" (and
    xmlns:prefix="")
  • Fix DomReader's handling of non-namespace aware elements/nodes that return
    null as localName.
  • In DomReader handle the fact that JVM's xpath creates xmlns declarations for
    xmlns.
  • Fix unsigned serialization of value classes.

0.85.0 – Tying things up

19 Feb 14:01
Compare
Choose a tag to compare

Features:

  • Implement serialization of maps. The outer container will be eluded as with lists. If the key type can be an attribute (and doesn't overlap with an attribute in the value) it will be written on the value, otherwise an entry will be written with the key written on it (as attribute or tag). Note that as this point keys must precede values due to the implementation of map serialization. The behaviour can be customized through the policy.
  • Add the possibility to specify namespace declarations that are ensured on tags (note that this does not yet participate in the namespace collating code)
  • Fix polymorphic usage of value classes as children of a sealed interface.
  • Add a defaultPolicy configurator to XmlConfig.Builder that allows more elegant configuration of the default policy. Some of the properties that can be specified on the XmlConfig.Builder have been deprecated in place of this new (more robust) mechanism.
  • Within the default policy builder add support for configuring the unknown child handling with some defaults: ignoreUnknownChildren and ignoreUnknownNamespace. Note that these are shortcuts to setting an explicit handler.
  • Now when a tag is marked to not preserve space (preserving is the default), but when the value starts or ends with whitespace this will result the xml:space="preserve" attribute to be emitted. The decoder will also honour this attribute over default behaviour for that type.
  • Support custom delimiters by allowing a list of delimiters to be specified the policy.

Fixes:

  • Make actual serialization of maps (that are not attributes) work
  • Fix an infinite recursion bug in the namespace collection code that writes namespace declarations on the top level.
  • Fix writing codepoints > 0x10000 that require surrogate pairs.
  • Fix whitespace handling #120
  • Remove stale logging code: #119

0.84.3 – Tidy things up

25 Sep 16:41
Compare
Choose a tag to compare

Features:

  • Add the ability to have polymorphic root tags (#98). Note that for
    a non-transparent approach it is strongly advised to explicitly
    provide the tagname polymorphic types do not support annotations on
    the type.

Fixes:

  • Fix reading of entity references. #88
  • Fix NamedNodeMap iterator (an issue for dom based apis)
  • Support Kotlin 1.7.10
  • Fix namespaceholder's getPrefix to not offer overridden prefixes. This
    addresses #99.
  • Dom getLocalName may return null for some implementations (where there is no
    namespace).
  • Fix empty namespace handling for dom namespace attributes
  • In DOMReader make sure that namespace declaration attributes are not exposed
    as double (as attribute and nsDecl) events.

0.84.2 – Keep it going

04 May 10:17
Compare
Choose a tag to compare

Features:

  • Add @XmlIgnoreWhitespace annotation to allow not retaining whitespace with
    an @XmlValue field of type List<CompactFragment>

Fixes:

  • Fix storing comment events
  • Don't defer serializing inline values as that is not valid. This
    also addresses a potential similar issue when reordering.
  • When deserializing element content to a List<CompactFragment> retain
    ignorable whitespace.
  • Fix the StringReader implementation for native (an issue with parsing from
    strings over 8192 characters long). #86.

0.84.1 – Just a bit better

02 Mar 17:21
Compare
Choose a tag to compare

Features:

  • Enable NodeSerializer and ElementSerializer on all platforms. Note that for
    JS it is not registered in the context due to technical limitations.

Fixes:

  • Fix handling of whitespace text (#84)
  • Fix compilation on native with 1.6.20 (#85) and a general infinite loop bug
    when retrieving doctype on a document in native.

0.84.0 – All the small features

11 Jan 20:35
Compare
Choose a tag to compare

0.84.0

(Jan 11, 2022)

Features:

  • Support (de)serializing anyElement content into a list of CompactFragments if
    annotated with @XmlValue. Each element will be deserialized individually,
    text is not allowed. While order is preserved, declared children will be parsed
    out of order.
  • Support DOM on all platforms. This includes a minimal implementation for native
    but delegating to the jvm/js implementations on those platforms (to allow
    consistency). Note that this doesn't independently support DOM on nodejs

Fixes:

  • Fix native parser for depth>=4
  • Improve handling of attribute prefixes and namepaces to be standard compliant
  • Fix execution of native tests (not user visible)
  • Fix module names (due to variable name clash in build script). Thanks to
    @rsinukov in pull request #79

0.84.0-RC1

(Nov 3, 2021)

Features:

  • Add @XmlCData annotation to force serialization as CData for a type (#71)
  • Allow compact fragments to be used transparently in conjunction with the
    @XmlValue annotation (it requires use of the CompactFragmentSerializer).
  • Add XmlBufferReader as a reader of lists of events (the counterpoint to
    @XmlBufferedWriter)
  • Support serializing lists of primitives (or inlines of primitives, or qnames).
    This is derived from the xml schema standard (and needed for xml schema).
  • Support storing unknown attributes in a Map<QName, String>
    (Using [QNameSerializer] or contextual). The field needs to be annotated with
    @XmlOtherAttributes. (Technically other types than QName and String are
    supported, but only if all values will be able to read from that string value)
  • add methods on [XmlInput] and [XmlOutput] to allow custom serializers the
    ability to ensure a prefix is registered/look it up.
  • Support using the xml schema instance namespace type attribute as type
    discriminator for all reading, and an type discriminator attribute mode
    specified by the policy. This uses the QName for the type (using existing
    mechanisms), but amended to map kotlin primitive names to XMLSchema types.
    Note that this mechanism is only for polymorphic serialization, no
    substitution happens outside the polymorphic case (the same way that
    substitution) needs to be declared in XMLschema.
  • Support using XMLSchema instance nil attributes (or a user configured
    alternative). The nil attribute is recognized unconditionally, but only
    written if specified.
  • Explicitly expose the platform independent writer (KtXmlWriter), it has been
    moved out of the implementation package, and can also be created by the
    XmlStreaming object (using newGenericWriter). Serialization can use this
    writer to have more predictable outputs.
  • Create (based upon kxml2) a platform independent parser (KtXmlReader) in line
    with the writer.
  • Support generating xml in either version 1.0 or 1.1 (with the platform
    independent writer)

Fixes:

  • Update to kotlinx.serialization-1.3.0-RC
  • Fix/change XmlReader.namespaceDecls (make it a member, not an extension)
  • Fix compact fragments that redeclare the default namespace
  • Fix deserialization of empty types where decodeElementIndex is never called
    (this applies for object)
  • Fix XmlBufferedReader's use of it's own namespace context and initializing
    it properly for the initial event (adding all visible namespaces).

0.84.0-rc1 – Just checking - a grab bag of goodies

04 Nov 20:52
Compare
Choose a tag to compare

Various changes. Released as release candidate as many changes (including native support) may have unforeseen issues. It should be stable though.

Features:

  • Add @XmlCData annotation to force serialization as CData for a type (#71)
  • Allow compact fragments to be used transparently in conjunction with the
    @XmlValue annotation (it requires use of the CompactFragmentSerializer).
  • Add XmlBufferReader as a reader of lists of events (the counterpoint to
    @XmlBufferedWriter)
  • Support serializing lists of primitives (or inlines of primitives, or qnames).
    This is derived from the xml schema standard (and needed for xml schema).
  • Support storing unknown attributes in a Map<QName, String>
    (Using [QNameSerializer] or contextual). The field needs to be annotated with
    @XmlOtherAttributes. (Technically other types than QName and String are
    supported, but only if all values will be able to read from that string value)
  • add methods on [XmlInput] and [XmlOutput] to allow custom serializers the
    ability to ensure a prefix is registered/look it up.
  • Support using the xml schema instance namespace type attribute as type
    discriminator for all reading, and an type discriminator attribute mode
    specified by the policy. This uses the QName for the type (using existing
    mechanisms), but amended to map kotlin primitive names to XMLSchema types.
    Note that this mechanism is only for polymorphic serialization, no
    substitution happens outside the polymorphic case (the same way that
    substitution) needs to be declared in XMLschema.
  • Support using XMLSchema instance nil attributes (or a user configured
    alternative). The nil attribute is recognized unconditionally, but only
    written if specified.
  • Explicitly expose the platform independent writer (KtXmlWriter), it has been
    moved out of the implementation package, and can also be created by the
    XmlStreaming object (using newGenericWriter). Serialization can use this
    writer to have more predictable outputs.
  • Create (based upon kxml2) a platform independent parser (KtXmlReader) in line
    with the writer.
  • Support generating xml in either version 1.0 or 1.1 (with the platform
    independent writer)

Fixes:

  • Update to kotlinx.serialization-1.3.0-RC
  • Fix/change XmlReader.namespaceDecls (make it a member, not an extension)
  • Fix compact fragments that redeclare the default namespace
  • Fix deserialization of empty types where decodeElementIndex is never called
    (this applies for object)
  • Fix XmlBufferedReader's use of it's own namespace context and initializing
    it properly for the initial event (adding all visible namespaces).