com.neko233.config233.reader.xml.XmlConfigHandler.kt Maven / Gradle / Ivy
package com.neko233.config233.reader.json
import com.neko233.config233.exception.ConfigFileNotFoundException
import com.neko233.config233.reader.ConfigHandler
import com.neko233.config233.reader.convert.ConfigOrmUtils
import com.neko233.config233.reader.dto.FrontEndConfigDto
import com.neko233.config233.utils.StringUtilsForConfig233
import com.neko233.easyxml.XML
import java.io.File
import java.nio.charset.StandardCharsets
// xml 文件处理类
class XmlConfigHandler : ConfigHandler {
override fun typeName(): String {
return "XML"
}
override fun readToFrontEndDataList(
configName: String,
configFileFullPath: String,
): FrontEndConfigDto {
val file = File(configFileFullPath)
if (!file.exists()) {
throw ConfigFileNotFoundException("XML config file not found. path = ${configFileFullPath}")
}
val xml = file.readText(StandardCharsets.UTF_8)
//
val rootXml = XML.parseToObject(xml)
val dataList: List