Skip to content

Instantly share code, notes, and snippets.

@Gizmodo
Created November 17, 2021 22:10
Show Gist options
  • Save Gizmodo/2be0daac781fc88904fef514c1c0b880 to your computer and use it in GitHub Desktop.
Save Gizmodo/2be0daac781fc88904fef514c1c0b880 to your computer and use it in GitHub Desktop.
work
<?xml version="1.0" encoding="utf-8"?>
<catalog>
<book id="Book 1 attr" name="!Дес049"></book>
<book id="Book q attr" Наименование="!Дес049"></book>
<book id="Book 2 attr">Book 2 value</book>
<book id="Book 3 attr"/>
<Магазин Наименование="!!!!!!" Адрес="\\192.168.0.154\TSD49" ПрефиксМагазина="Т49" ПрефиксВесовогоТовара="22" ПрефиксВесовогоТовараПЛУ="23" ПрефиксШтучногоТовара="24"/>
<book Наименование="!2222222" Адрес="\\192.168.0.154\TSD49" ПрефиксМагазина="Т49" ПрефиксВесовогоТовара="22" ПрефиксВесовогоТовараПЛУ="23" ПрефиксШтучногоТовара="24"/>
</catalog>
package com.shop.tcd.model
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.PropertyElement
import com.tickaroo.tikxml.annotation.Xml
import java.io.Writer
@Xml(name = "catalog")
class Task {
@Element
var books: List<Book>? = null
}
@Xml(name="Магазин")
class Book {
@Attribute(name = "id")
var id: String? = null
@Attribute(name = "name")
var name: String? = null
@Attribute(name = "Наименование")
var nameRus: String? = null
@Attribute(name = "Адрес")
var address: String? = null
@Attribute(name = "ПрефиксМагазина")
var prefShop: String? = null
@Attribute(name = "ПрефиксВесовогоТовара")
var prefixWeight: String? = null
@Attribute(name = "ПрефиксВесовогоТовараПЛУ")
var prefixWeightPLU: String? = null
@Attribute(name = "ПрефиксШтучногоТовара")
var prefixSingle: String? = null
@PropertyElement
var title: String? = null
}
@Xml(name = "Настройки")
data class Task3(
@Attribute
val id: String? = null,
@PropertyElement
val title: String? = null,
@Element(name = "catalog")
// var catalog: Catalog? = null
val catalog: List<Book>,
/* @Element
val author: Author,*/
// @Element(name = "Магазины")
// val shops: XShop,
)
@Xml
class Author {
@Attribute(name = "test")
var test: String? = null
@PropertyElement
var firstname: String? = null
@PropertyElement
var lastname: String? = null
@PropertyElement
var catalog: Catalog? = null
}
@Xml
data class Book1(
/* @Attribute
var id: String? = null,*/
@PropertyElement
var id: String? = null,
)
@Xml
data class Catalog(
@Element
var books: List<Book>? = null,
)
@Xml
class Shops1 {
@PropertyElement
var shop: Shop? = null
}
@Xml
class Shop {
@Attribute
var name: String? = null
}
@Xml(name = "Магазин")
data class XShop(
@Attribute(name = "Наименование")
val name: String? = null,
@Attribute(name = "Адрес")
val address: String? = null,
@Attribute(name = "ПрефиксМагазина")
val prefShop: String? = null,
@Attribute(name = "ПрефиксВесовогоТовара")
val prefixWeight: String? = null,
@Attribute(name = "ПрефиксВесовогоТовараПЛУ")
val prefixWeightPLU: String? = null,
@Attribute(name = "ПрефиксШтучногоТовара")
val prefixSingle: String? = null,
)
@Xml(name = "Настройки")
data class Task1(
@PropertyElement(name = "Магазины")
val shops: XMLShops,
@PropertyElement(name = "Пользователи")
val users: XMLUsers,
)
@Xml(name = "Пользователи")
data class XMLUsers(
@Element(name = "Группа")
val group: String? = null,
)
@Xml(name = "Магазин_")
data class XMLShops(
@Attribute(name = "Наименование")
val name: String? = null,
@Attribute(name = "Адрес")
val address: String? = null,
@Attribute(name = "ПрефиксМагазина")
val prefShop: String? = null,
@Attribute(name = "ПрефиксВесовогоТовара")
val prefixWeight: String? = null,
@Attribute(name = "ПрефиксВесовогоТовараПЛУ")
val prefixWeightPLU: String? = null,
@Attribute(name = "ПрефиксШтучногоТовара")
val prefixSingle: String? = null,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment