{"id":13659309,"url":"https://github.com/pdvrieze/xmlutil","last_synced_at":"2025-05-15T09:02:56.289Z","repository":{"id":36587656,"uuid":"143553364","full_name":"pdvrieze/xmlutil","owner":"pdvrieze","description":"XML Serialization library for Kotlin","archived":false,"fork":false,"pushed_at":"2025-04-06T16:52:56.000Z","size":13557,"stargazers_count":412,"open_issues_count":25,"forks_count":32,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-07T04:06:02.520Z","etag":null,"topics":["android","javascript-support","jvm","kotlin-library","multi-platform","multi-target","serialization","xml"],"latest_commit_sha":null,"homepage":"https://pdvrieze.github.io/xmlutil/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pdvrieze.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-04T18:36:32.000Z","updated_at":"2025-04-02T13:52:02.000Z","dependencies_parsed_at":"2023-10-03T19:30:35.841Z","dependency_job_id":"3040abe1-13f9-4498-a969-63245e0a2cb1","html_url":"https://github.com/pdvrieze/xmlutil","commit_stats":null,"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdvrieze%2Fxmlutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdvrieze%2Fxmlutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdvrieze%2Fxmlutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdvrieze%2Fxmlutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdvrieze","download_url":"https://codeload.github.com/pdvrieze/xmlutil/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248890560,"owners_count":21178464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","javascript-support","jvm","kotlin-library","multi-platform","multi-target","serialization","xml"],"created_at":"2024-08-02T05:01:07.339Z","updated_at":"2025-05-15T09:02:56.280Z","avatar_url":"https://github.com/pdvrieze.png","language":"Kotlin","readme":"# XmlUtil\n[![Build Status](https://dev.azure.com/pdvrieze/xmlutil/_apis/build/status/pdvrieze.xmlutil?branchName=master)](https://dev.azure.com/pdvrieze/xmlutil/_build/latest?definitionId=1\u0026branchName=master)\n[![GitHub license](https://img.shields.io/badge/License-Apache%202-blue.svg?style=flat)](COPYING)\n- Core:\u0026nbsp;[![Download](https://img.shields.io/maven-central/v/io.github.pdvrieze.xmlutil/core)](https://search.maven.org/artifact/io.github.pdvrieze.xmlutil/core)\n- Serialization:\u0026nbsp;[![Download](https://img.shields.io/maven-central/v/io.github.pdvrieze.xmlutil/serialization)](https://search.maven.org/artifact/io.github.pdvrieze.xmlutil/serialization)\n- SerialUtil:\u0026nbsp;[![Download](https://img.shields.io/maven-central/v/io.github.pdvrieze.xmlutil/serialutil)](https://search.maven.org/artifact/io.github.pdvrieze.xmlutil/serialutil)\n\nXmlUtil is a set of packages that supports multiplatform XML in Kotlin.\n\n### Introduction\n* Gradle wrapper validation: ![Validate Gradle Wrapper](https://github.com/pdvrieze/xmlutil/workflows/Validate%20Gradle%20Wrapper/badge.svg)\n\nThis project is a cross-platform XML serialization (wrapping) library compatible with kotlinx.serialization. \nIt supports all platforms although native is at beta quality.\n\nBased upon the core xml library, the serialization module supports automatic object\nserialization based upon Kotlin's standard serialization library and plugin. \n\n**Help wanted**: Any help with extending this project is welcome. Help is especially needed for the following aspects:\n\n* Documentation updates\n* Testing, in particular more extensive tests. Some tests already exist for both JVM and Android\n* Native xml library support: Native is only supported through the cross-platform implementation\n  that is somewhat limited in advanced features such as DTD and validation support. \n  Ideally integration with a well-developed native library as an option would be beneficial.\n\n#### Notes\nPlease note that the JVM target will **not** work on Android due to different\nserialization libraries. It is possible to consume the multiplatform targets on\nsingle-target Kotlin although there may be issues with older Gradle versions not\nfinding the correct version. As a workaround for single-platform Android projects,\ntry adding the following code to your Gradle build file:\n\n```kotlin\nkotlin {\n    target {\n        attributes {\n            if (KotlinPlatformType.attribute !in this) {\n                attribute(KotlinPlatformType.attribute, KotlinPlatformType.androidJvm)\n            }\n        }\n    }\n}\n\nKotlinPlatformType.setupAttributesMatchingStrategy(dependencies.attributesSchema)\n```\nThis code tells Gradle that are targeting Android when it resolves multi-platform libraries.\nIn other cases you can use the different platform types.\n\n### Versioning scheme\nThis library is based upon the unstable [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) library. \nWhile every effort is made to limit incompatible changes, this cannot be guaranteed even in \"minor\" versions when\nthe changes are due to bugs. These changes *should* mostly be limited to the serialization part of the library.\n\n## How to use\nThe library is designed as a multiplatform Kotlin module, but platform-specific versions can also be used were appropriate.\n### Add repository\nThe project's Maven access is hosted on OSS Sonatype (and available from Maven Central).\n\nReleases can be added from **maven central**\n\nThey are also available directly from Sonatype by adding the following to your\nGradle build file:\n```groovy\nrepositories {\n\tmaven {\n\t\turl  \"https://s01.oss.sonatype.org/content/repositories/releases/\"\n\t}\n}\n```\n\nSnapshots are available from:\n```groovy\nrepositories {\n\tmaven {\n\t\turl  \"https://s01.oss.sonatype.org/content/repositories/snapshots/\"\n\t}\n}\n```\n\n### Core\nIt should be noted that the JVM and Android packages are no longer part\nof the multiplatform publication (they are combined into a `jvmCommon`)\npackage. The `JVM` and `Android` packages provide the native\nimplementations and depend on (publishing) the `jvmCommon` package.\n#### multiplatform (will default to multiplatform implementation for JVM/Android)\n```\n   implementation(\"io.github.pdvrieze.xmlutil:core:0.91.0\")\n```\n#### **Optional** JVM – uses the stax API _not available_ on Android\n```\n   implementation(\"io.github.pdvrieze.xmlutil:core-jdk:0.91.0\")\n```\n#### **Optional** Android – Uses the android streaming library\n```\n   implementation(\"io.github.pdvrieze.xmlutil:core-android:0.91.0\")\n```\n#### JS – Wraps DOM\n```\n   implementation(\"io.github.pdvrieze.xmlutil:core-js:0.91.0\")\n```\n\n#### Native\nHas platform independent implementations of xml parsing/serialization\n(based upon the Android implementation) and DOM (a simple implementation\nthat mirrors the Java API)\n\n### Serialization\n#### multiplatform\n```\n   implementation(\"io.github.pdvrieze.xmlutil:serialization:0.91.0\")\n```\n#### JVM\n```\n   implementation(\"io.github.pdvrieze.xmlutil:serialization-jvm:0.91.0\")\n```\n#### -Android- (Deprecated - this is dependency only - it has no code)\n** Deprecated **\n```\n   implementation(\"io.github.pdvrieze.xmlutil:serialization-android:0.91.0\")\n```\n\nThis version is merely a dependency to the main module that no longer has the android\nspecific artefact as this is not supported by kotlin (and has resolution issues).\n\n#### js\n```\n   implementation(\"io.github.pdvrieze.xmlutil:serialization-js:0.91.0\")\n```\n\n### -Ktor- (Deprecated)\n\n**Deprecated**\n\nThis library is no longer supported. Instead use official Ktor xml serialization\nsupport. It is mostly equal to this version.\n\n## Serialization help\n### Hello world\nTo serialize a very simple type you have the following:\n```kotlin\n@Serializable\ndata class HelloWorld(val user: String)\n\nprintln(XML.encodeToString(HelloWorld(\"You!\")))\n```\n\nTo deserialize you would do:\n```kotlin\n@Serializable\ndata class HelloWorld(val user: String)\n\nXML.decodeFromString(HelloWorld.serializer(), \"\u003cHelloWorld user='You!' /\u003e\")\n```\n\nPlease look at the examples and the documentation for further features\nthat can influence: the tag names/namespaces used, the actual structure\nused (how lists and polymorphic types are handled), etc.\n\n### Examples\nYou should be able to find examples in the [Examples module](examples/README.md)\n### Format\nThe entrypoint to the library is the `XML` format. There is a default, but often a child is better. \nCustom formats are created through:\n```kotlin\nval format = XML(mySerialModule) {  \n    // configuration options\n    autoPolymorphism = true \n}\n```\nThe following options are available when using the XML format builder:\n\n| Option                     | Description                                                                                                                                                                                                                                                                 |\n|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| \n| `repairNamespaces`         | Should namespaces automatically be repaired. This option will be passed on to the `XmlWriter`                                                                                                                                                                               |\n| `xmlDeclMode`              | The mode to use for emitting XML declarations (\u003c?xml ...?\u003e). Replaces omitXmlDecl for more finegrained control                                                                                                                                                              |\n| `indentString`             | The indentation to use. Must be a combination of XML whitespace or comments (this is checked). This is passed to the `XmlWriter`                                                                                                                                            |\n| -`autoPolymorphic`-        | *Deprecated* Shorcut to `policy.autoPolymorphic`                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                      |\n| `isInlineCollapsed`        | If `true`(default) the content of an inline type is used directly, with the name of the inline type.                                                                                                                                                                        |\n| `xmlVersion`               | Which xml version will be written/declared (default XML 1.1)                                                                                                                                                                                                                |\n| `isCollectingNSAttributes` | (Attempt to) collect all needed namespace declarations and emit them on the root tag, this does have a performance overhead                                                                                                                                                 |\n| `defaultToGenericParser`   | Use the generic parser, rather than the platform specific one.                                                                                                                                                                                                              |\n| `policy`                   | This is a class that can be used to define a custom policy that informs how the kotlin structure is translated to XML. It drives most complex configuration                                                                                                                 |\n| `defaultPolicy {}`         | Builder that allows configuring the default policy. This policy is stable, it doesn't change across versions.                                                                                                                                                               |\n| `recommended_0_86_3 {}`    | Builder that sets the policy to the recommended defaults per version 0.86.3, this is stable and includes: autopolymorphic, inlineCollapsed, indent=4, p.pedantic, p.typeDiscriminatorName=xsi:type, encodeDefault=ANNOTATED, throwOnRepeatedElement, isStrictAttributeNames |                                                                                                                                                                                                                  \n| `recommended_0_90_2 {}`    | Builder that sets the policy to the recommended defaults per version 0.90.2, this is stable and extends from 0.86.3. It uses xml 1.1, strict booleans, and minimal xml declaration                                                                                          |                                                                                                                                                                                                                  \n| `fast_0_90_2 {}`           | Builder that sets the policy to the recommended for fast parsing. This reduces error checks, but otherwise has the same semantics as 0.90.2.                                                                                                                                |                                                                                                                                                                                                                  \n| `recommended {}`           | Builder that sets the policy to the *currently* recommended defaults (the 0.90.2 configuration)                                                                                                                                                                             |                                                                                                                                                                                                                  \n| -`indent`-                 | *Deprecated for reading*: The indentation level (in spaces) to use. This is backed by `indentString`. Reading is \"invalid\" for `indentString` values that are not purely string sequences. Writing it will set indentation as the specified amount of spaces.               |\n| -`omitXmlDecl`-            | *Deprecated* (use `xmlDeclMode`). Should the generated XML contain an XML declaration or not. This is passed to the `XmlWriter`                                                                                                                                             |\n| -`unknownChildHandler`-    | *Deprecated into policy* A function that is called when an unknown child is found. By default an exception is thrown but the function can silently ignore it as well.                                                                                                       |\n\nThe properties that have been moved into the policy can still be set in the builder,\nbut are no longer able to be read through the config object.\n\nThe following options are available as part of the default policy builder. Note that the policy\nis designed to allow configuration through code, but the default policy has significant\nconfiguration options available.\n\n| Option                   | Description                                                                                                                                                                                                                                                                                                             |\n|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `pedantic`               | Fail on output type specifications that are incompatible with the data, rather than silently correcting this                                                                                                                                                                                                            |\n| `autoPolymorphic`        | When not specifying a custom policy this determines whether polymorphism is handled without wrappers. This replaces `XmlPolyChildren`, but changes serialization where that annotation is not applied. This option will become the default in the future although XmlPolyChildren will retain precedence (when present) |\n| `encodeDefault`          | Determine whether in which cases default values should be encoded.                                                                                                                                                                                                                                                      |\n| `unknownChildHandler`    | A function that is called when an unknown child is found. By default an exception is thrown but the function can silently ignore it as well.                                                                                                                                                                            |\n| `typeDiscriminatorName`  | This property determines the type discriminator attribute used. It is always recognised, but not serialized in transparent polymorphic (autoPolymorphic) mode. If this is null, a wrapper tag with type attribute is used instead of a discriminator.                                                                   |\n| `throwOnRepeatedElement` | Rather than silently allowing a repeated element (not part of a list), throw an exception if the element occurs multiple times.                                                                                                                                                                                         |\n| `verifyElementOrder`     | While element order (when specified using `@XmlBefore` and `@XmlAfter`) is always used for serialization, this flag allows checking this order on inputs.                                                                                                                                                               |\n| `isStrictAttributeNames` | Enables stricter, standard compliant attribute name mapping in respect to default/null namespaces. Mainly relevant to decoding.                                                                                                                                                                                         |\n| `isStrictBoolean`        | Parse boolean variables according to the XML Schema standard.                                                                                                                                                                                                                                                           |\n| `isXmlFloat`             | Encode xml float/double values according to the XML Schema standard, not the JVM one (infinity is encoded differently)                                                                                                                                                                                                  | \n\n### Algorithms\nXML and Kotlin data types are not perfectly alligned. As such there are some\nalgorithms that aim to automatically make a \"best attempt\" at structuring the XML\ndocument. Most of this is implemented in the *default* `XmlSerializationPolicy`\nimplementation, but this can be customized/replaced with a policy that results\nin a different structure. The policy includes the mapping from types/attributes\nto tag and attribute names.\n\n#### Storage type\nIn the default policy, the way a field is stored is automatically determined to be one of: Element, Attribute, Text or\nMixed. Mixed is a special type that allows for mixing of text and element content and requires some special treatment.:\n- If a field is annotated with `@XmlElement` or `XmlValue` this will take precedence. The XmlValue tag will\n  allow the field to hold element text content (direct only).\n- If the serializer is a primitive this will normally be serialized as attribute\n- If the serializer is a list, if there is an `@XmlChildrenName` annotation, this\n  will trigger named list mode where a wrapper tag (element) is used. Otherwise\n  the list elements, even primitives, will be written directly as tags (even\n  primitives) without any wrapper list tags.\n- If a list has the `@XmlValue` tag, this will allow the list to hold mixed content.\n  To actually support text content it needs to be a list of `Any`. This should \n  also be polymorphic (but the annotation is required).\n  - Lists of `Element`s (using `ElementSerializer`) and `CompactFragment`s support\n  arbitrary content and provide it as lists of fragments or nodes. \n- If a primitive is written as tag, the type name is used as tag name,\n  and value as its element content.\n- A primitive written as TEXT will be text content only, but note that there are\n  only few cases where this is valid.\n- Polymorphic properties are treated specially in that the system does not\n  use/require wrappers. Instead it will use the tag name to determine the type.\n  The name used is either specified by an `@XmlPolyChildren` annotation or through the\n  type's `serialDescriptor`. This also works inside lists, including\n  transparent (invisible) lists. If multiple polymorphic properties have the\n  same subtags, this is an error that may lead to undefined behaviour (you can\n  use the `@XmlPolyChildren` to have different names).\n  \n  A custom policy is able to determine on individual basis whether transparent\n  polymorphism should be used, but the default policy provides an overall toggle\n  (which also respects the autopolymorphic property of the configuration builder).\n  The default will always trigger transparent mode if `XmlPolyChildren` is present.\n  \n- If the serializer is polymorphic, tag mode will be enforced. If `@XmlPolyChildren`\n  is specified or `autoPolymorphic` is set it triggers transparent polymorphism\n  mode where the child name is used to look up the property it belongs to. (note\n  that this is incorrect with multiple properties that could contain the same\n  polymorphic value - unless @XmlPolyChildren overrides it).\n- Otherwise it will be written as a tag.\n\n#### Tag/attribute name\nThe way the name is determined is configured/implemented through the configured policy. The documentation below\nis for the default policy. This is designed to allow customization by users.\n\nBased upon the storage type, the effective name for an attribute is determined as follows:\n- `@XmlSerialName` at property declaration site\n- `@XmlSerialName` at type declaration site\n- `@SerialName` at property declaration site\n- property name at property declaration site (note that the `@SerialName` annotation is invisible to the encoder)\n\nThe effective name for a regular tag is determined as follows for normal serializers:\n- `@XmlSerialName` at property declaration site\n- `@XmlSerialName` at type declaration site\n- `@SerialName` at type declaration site\n- type name at type declaration site.\nThe default type declaration type name is the Kotlin/Java type name (and long). The system will try to shorten this by\neliding the package name. This is configurable in the policy. \n\nThe effective name for a polymorphic child is determined as follows:\n- If the child is transparent, the annotations/serial name of the effective type is used (unless overridden by `@XmlPolyChildren`)\n- If the child is not transparent, the container is treated as a regular tag. It will have a `type` attribute to contain\n  the serial name of the type (shortened to share the package name with the container). The value will use the default\n  name `value`.\n\nThe implementation if serialization in the Kotlin compiler does not allow distinguishing between the automatic name and\na `@SerialName` annotation. The default implementation supposes that if there is a '`.`' character in the name, this is\na java type name and it strips the package out. (This also when it could be an attribute).\n\nIf you need to support names with dots in your format, either use the `@XmlSerialName` annotation, or use a\ndifferent policy.\n\n### Annotations\n\nThe annotations that specify names have common attributes: `value:String`,\n`namespace:String` and `prefix:string`. They have common semantics:\n\n| parameter           | description                                                                                                                                  |\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| `value: String`     | The local part of the tag name to use. If optional and not specified the serial name of the property/type will be used.                      |\n| `namespace: String` | The namespace part of the tag name to use. If not specifies defaults to the namespace of the containing tag                                  |\n| `prefix: String`    | Suggested prefix to use, overridden by existing prefixes for the namespace. Will cause a namespace declaration/prefix to be added if needed. |\n\nAnnotation explanation.\n\n| Annotation                  | Property                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n|-----------------------------|--------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `@XmlSerialName`            |                                                        | Specify more detailed name information than can be provided by `kotlinx.serialization.SerialName`. In particular, it is not reliably possible to distinguish between `@SerialName` and the type name. We also need to specify namespace and prefix information.                                                                                                                                                                                                                                        |\n|                             | `value: String`, `namespace: String`, `prefix: String` | See table above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n| ~~`@XmlNamespaceDeclSpec`~~ |                                                        | *Deprecated in favour of [XmlNamespaceDeclSpec]. Annotation allowing to specify namespaces specifications to be generated upon the element. As multiple annotations are not supported by the plugin this uses a single string. The string separates the namespaces using a semicolon (`;`). Each declaration is of the form (prefix)=(namespace). To specify the default namespace it is valid to omit the equals sign.                                                                                |\n|                             | `value: String`                                        | The actual specification: `\"prefix1=urn:namespace1;defaultNamespace\"`                                                                                                                                                                                                                                                                                                                                                                                                                                  |\n| `@XmlNamespaceDeclSpecs`    |                                                        | Annotation allowing to specify namespaces specifications to be generated upon the element. As multiple annotations are not supported by the plugin this uses a single string. Each declaration is of the form (prefix)=(namespace). To specify the default namespace it is valid to omit the equals sign.                                                                                                                                                                                              |\n|                             | `vararg value: String`                                 | The actual specification: `\"prefix1=urn:namespace1\", \"defaultNamespace\"`                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| `@XmlPolyChildren`          |                                                        | Indicate the valid polymorphic children for this element. This is a legacy annotation supporting polymorphic (de)serialization without modules.                                                                                                                                                                                                                                                                                                                                                        |\n|                             | `value: Array\u003cString\u003e`                                 | Each string specifies a child according to the following format: `childSerialName[=[prefix:]localName]`. The `childSerialName` is the name value of the descriptor. By default that would be the class name, but `@SerialName` will change that. If the name is prefixed with a `.` the package name of the container will be prefixed. Prefix is the namespace prefix to use (the namespace will be looked up based upon this). Localname allows to specify the local name of the tag.                |\n| `@XmlChildrenName`          |                                                        | Specify additional information about child values in collections. This is only used for primitives, not for classes that have their own independent name. The outer tag name is determined regularly.                                                                                                                                                                                                                                                                                                  |\n|                             | `value: String`                                        | **Mandatory**, see table above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n|                             | `namespace: String`, `prefix: String`                  | See table above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n| `@XmlKeyName`               |                                                        | Used to specify the xml name used for the key attribute/tag of a map.                                                                                                                                                                                                                                                                                                                                                                                                                                  |\n|                             | `value: String`                                        | **Mandatory**, see table above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n|                             | `namespace: String`, `prefix: String`                  | See table above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n| `@XmlMapEntryName`          |                                                        | Dual use annotation that both forces explicit map entry wrappers and specifies the tag name used. The default is to elude the wrappers in the case that data does not contain an attribute with the name of the key.                                                                                                                                                                                                                                                                                   |\n|                             | `value: String`                                        | **Mandatory**, see table above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n|                             | `namespace: String`, `prefix: String`                  | See table above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n| `@XmlElement`               |                                                        | Force a property that could be an attribute to be an element. Note that default behaviour requires this annotation to be absent.                                                                                                                                                                                                                                                                                                                                                                       |\n|                             | `value: Boolean`                                       | `true` to indicate serialization as tag, `false` to indicate serialization as attribute. Note that not all values can be serialized as attribute.                                                                                                                                                                                                                                                                                                                                                      |\n| `@XmlValue`                 |                                                        | Force a property to be content of the tag (for the object containing the property). This is both for text content (polymorphic including a primitive), but if the type is a list of tag-like types (`Node`, `Element`, `CompactFragment`) it will also allow mixed content of tags not supported by the base type. Strings will be serialized/deserialized as (tag soup) string content without wrapper.                                                                                               |\n|                             | `value: Boolean`                                       | `true` to indicate the value. `false` and absence are equivalent.                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| `@XmlId`                    |                                                        | Annotation to mark the value as an ID attribute. This implies that the element is an attribute. This will allow the serializer to enforce uniqueness.                                                                                                                                                                                                                                                                                                                                                  |\n| `@XmlIgnoreWhitespace`      |                                                        | Determine whether whitespace should be ignored or preserved for the tag.                                                                                                                                                                                                                                                                                                                                                                                                                               |\n|                             | `value: Boolean`                                       | `true` if whitespace is to be ignored, `false` if preserved.                                                                                                                                                                                                                                                                                                                                                                                                                                           |\n| `@XmlOtherAttributes`       |                                                        | This annotation allows handling wildcard attributes. It should be specified on a  `Map\u003cQName, String\u003e` to store unsupported attributes. The key is preferred to be a QName, alternatively it must convert to String (this could be \"prefix:localName\"). The value must be a String type. **Note** that if the key runtime type is a `QName` the value is directly used as attribute name without using the key serializer.                                                                             |\n| `@XmlCData`                 |                                                        | Mark the property for serialization as CData, rather than text (where appropriate). If used on a property this will override the annotation on a type. This is the only context in which a value of `false` is different from omitting the annotation.                                                                                                                                                                                                                                                 |\n| `@XmlDefault`               |                                                        | Allow a property to be omitted with a default serialized string. This annotation primarily supports older versions of the framework that do not support default attribute values. The default value will not be written out if matched.                                                                                                                                                                                                                                                                |\n|                             | `value: String`                                        | The default value used if no value is specified. The value is parsed as if there was textual substitution of this value into the serialized XML.                                                                                                                                                                                                                                                                                                                                                       |\n| `@XmlBefore`                |                                                        | Require this property to be serialized before other (sibling) properties. Together [XmlBefore] and [XmlAfter] define a partial order over the properties. Using this annotation may cause values to be serialized as elements rather than attributes where not explicitly specified as attributes. If there is a conflict between serialization type (attribute/element) this takes precendence over this attribute. The names are the serialNames of the properties being serialized (not XML names). |\n|                             | `value: Array\u003cString\u003e`                                 | The serial names of all the children that should be serialized after this one (uses the [kotlinx.serialization.SerialName] value or field name).                                                                                                                                                                                                                                                                                                                                                       |\n| `@XmlAfter`                 |                                                        | Require this property to be serialized after other (sibling) properties. Together [XmlBefore] and [XmlAfter] define a partial order over the properties. Using this annotation may cause values to be serialized as elements rather than attributes where not explicitly specified as attributes. If there is a conflict between serialization type (attribute/element) this takes precendence over this attribute. The names are the serialNames of the properties being serialized (not XML names).  |\n|                             | `value: Array\u003cString\u003e`                                 | The serial names of all the children that should be serialized before this one (uses the [kotlinx.serialization.SerialName] value or field name).                                                                                                                                                                                                                                                                                                                                                      |\n\n### Special types\nThese types have contextual support by default (without needed user intervention),\nbut the serializer can also be specified explicitly by the user. They get special\ntreatment to support their features.\n\n#### `QName`\nBy default (configurable by the policy) QName is handled by special logic that\nstores QNames in a prefix:localName manner ensuring the prefix is valid in the\ntag. Many XML standards use this approach for string attributes.\n\n#### `CompactFragment`\nThe `CompactFragment` class is a special class (with supporting serializer) that will be able to capture the tag soup\ncontent of an element. Instead of using regular serialization its custom serializer will (in the case of xml serialization)\ndirectly read all the child content of the tag and store it as string content. It will also make a best effort attempt\nat retaining all namespace declarations necessary to understand this tag soup.\n\nAlternatively the serialutil subproject contains the `nl.adaptivity.serialutil.MixedContent` type that allows for\ntypesafe serialization/deserialization of mixed content with the proviso that the serialModule must use Any as the\nbaseclass for the content. \n\n### Modules\n\n#### core\nContainer for the core library (versions)\n\n#### core.common\nAll code shared between JavaScript and Java (either jvm or android)\n\n#### core.common-nonshared\nAll code that is common, but not shared between Jvm and Android platforms\n\n#### core.android\nCode specific to the Android platform (Pulls in core.java as API dependency). This is a regular jar rather than an AAR\nas the only specific thing to Android is the XML library\n\n#### core.java\nImplementation of the shared code for Java based platforms (both Android and JVM)\n\n#### core.js\nJavaScript based implementation\n\n#### core.jvm\nCode unique to the JVM platform (Pulls in core.java as API dependency)\n\n#### Serialization\nThe kotlinx.serialization plugin to allow serialization to XML\n\n#### Serialization.java\nThe java version of the serialization plugin. Please note that it does not pull in the platform specific library. The\ncore library is dependent on the actual platform used (JVM or Android). This library only pulls in the shared Java code.\n\n#### Serialization.jvm\nThe JVM version merely uses the jvm platform xml library but the serialization is\n#### Serialization.android\n\n#### Serialization.js\nThe JavaScript version of the serialization plugin.\n\n#### Serialization.test-android\nAn android test project to test serialization on Android.\n","funding_links":[],"categories":["Libraries","Processing Libraries"],"sub_categories":["🗃 Serializer","Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdvrieze%2Fxmlutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdvrieze%2Fxmlutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdvrieze%2Fxmlutil/lists"}