Tickaroo / tikxml

Modern XML Parser for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ordering not working properly with elements

rajasekaranm opened this issue · comments

Hi ,

I have added @Order annotation with my kotlin class but generated xml not in expected order

Java Class :

@Order(elements = ["soap-env:Header", "soap-env:Body"], attributes = ["soapEnv", "eb", "xlink", "xsd"])
@Xml(name = "soap-env:Envelope")
class ReqCreatePNR {
    @Attribute(name = "xmlns:soap-env")
    var soapEnv = "http://schemas.xmlsoap.org/soap/envelope/"

    @Attribute(name = "xmlns:eb")
    var eb = "http://www.ebxml.org/namespaces/messageHeader"

    @Attribute(name = "xmlns:xlink")
    var xlink = "http://www.w3.org/1999/xlink"

    @Attribute(name = "xmlns:xsd")
    var xsd = "http://www.w3.org/1999/XMLSchema"

    @Element(name = "soap-env:Header")
    var header = PNRHeader()

    @Element(name = "soap-env:Body")
    var body = PNRBody()
}

Generated XML :

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
   <soap-env:Body>
     
   </soap-env:Body>
   <soap-env:Header>

   </soap-env:Header>
</soap-env:Envelope>

What's would be issue ?

I have no idea what you are refering too ... TikXml has no @Order annotation.
The order is determined by the order in source code. See #103