ProblemXml

The application/problem+xml codec, per RFC 9457 Appendix B.

Hand-written over xmlutil's plain XmlReader/XmlWriter, not driven by a serialization framework. Extension members produce element names that are only known at runtime, and a serial descriptor cannot express that.

Properties

Link copied to clipboard

Appendix B: an element whose children are all named i is an array.

Link copied to clipboard
const val MEDIA_TYPE: String

The media type as a plain String, since this module must not depend on Ktor.

Link copied to clipboard
const val NAMESPACE: String

RFC 9457 deliberately kept RFC 7807's namespace, because the wire format did not change. Emitting urn:ietf:rfc:9457 is a conformance bug that round-trips happily against itself, and one that shipped implementations have made repeatedly.

Link copied to clipboard
const val ROOT_ELEMENT: String

The name Appendix B gives the document element. The reader rejects a document rooted at anything else. §3's leniency covers members; it says nothing about accepting any XML document as a problem document.

Functions

Link copied to clipboard

Reads an application/problem+xml document, tolerating the deviations RFC 9457 §3 asks a consumer to tolerate: an unrecognised member, a wrong-typed one, a missing namespace.

Link copied to clipboard

Writes problem as an application/problem+xml document, always in UTF-8.