Skip to content

The struct have conflict path when a tag have both subtag and attribute. #2

@wicast

Description

@wicast

xml like this

<?xml version="1.0" encoding="utf-8"?>
<root>
    <channel id="1">
         <item></item>
         <item></item>
        <item></item>
   </channel>
</root>

will get structs like that

type Root struct {
    Channel Channel `xml:"channel"`
    Item    []string    `xml:"channel>item"`
}

type Channel struct {
    Id  string  `xml:"id,attr"`
}

This one have a conflict path,the correct from should be

type Root struct {
    Channel Channel `xml:"channel"`
}

type Channel struct {
    Id  string  `xml:"id,attr"`
    Item    []string    `xml:"item"`
}

Remove the conflict is a tough job with current data struct.

So I'm working a new version that can handle both nesting style and non-nesting style(without conflict).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions