mlrpc.protocol.2.0.1.source-code.MethodCall.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of protocol Show documentation
Show all versions of protocol Show documentation
xml-rpc implementation written in Kotlin
/*
* Copyright (c) 2022 Andreas Scheja. Use of this source code is governed by the Apache 2.0 license.
*/
package org.ascheja.xmlrpc.protocol
import org.w3c.dom.Document
import javax.xml.parsers.DocumentBuilder
public data class MethodCall(
val methodName: String,
val params: List
) {
public constructor(methodName: String, vararg params: Value) : this(methodName, params.toList())
public fun toDocument(): Document {
val document = createDocumentBuilder().newDocument()
with(Serializer(document)) {
appendToElement(document)
}
return document
}
public companion object {
public fun parse(block: (DocumentBuilder) -> Document): MethodCall {
return Deserializer().parseMethodCall(block(createDocumentBuilder()).documentElement)
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy