Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue parsing Custom XML Structure #47

Open
alexllao opened this issue Jun 13, 2019 · 1 comment
Open

Issue parsing Custom XML Structure #47

alexllao opened this issue Jun 13, 2019 · 1 comment

Comments

@alexllao
Copy link

alexllao commented Jun 13, 2019

Hi!

I've this XML Structure:

<xml>
<response>
    <data>
        <modules>
            <module>
                <id>1</id>
            </module>
        </modules>
    </data>
    <result_id>1</result_id>
    <result_text></result_text>
    <timeout>207</timeout>
</response>
</xml>

And my code to Parse this:

struct ModuleResponse: Codable {
    let result_id: Int?
    let result_text: String?
    let timeout: Int
    let modules: [Module]?

    enum CodingKeys: String, CodingKey {
        case result_text = "result_text"
        case result_id = "result_id"
        case timeout = "timeout"
        case modules = "modules"
    }
}

struct Module: Codable {
    let id: Int
}

Only get timeout value, others No value associated with key CodingKeys.....

Thnks a lot!

@EssoAwessoLNJ
Copy link

Hello @alexllao . Have you please succeed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants