Skip to content

How could I parser a XML file if the element and attribute has the same name? #44

@freseco

Description

@freseco

This is a example of the xml:

<datohoja idPN="263585" parametersamename="1"> <id>-1</id> <level>263585</level> <value><![CDATA[1]]></value> <checked>true</checked> <parametersamename>1</parametersamename> </maintag>

how you can see, there ir an attribute with the name "parametersamename" and an element with the same name.
I cannot modify the xml file I am parsing. How can I create the properties in the kotlin class? O is there another solution?

my code with error:
@field:Element(name = "parametersamename", required = false)
var parametersamename: String? = null
@field:Attribute(name = "parametersamename", required = false)
var parametersamename: String? = null

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions