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

Simillar elements inside are skipped #610

Open
aivanovski opened this issue Sep 16, 2023 · 5 comments
Open

Simillar elements inside are skipped #610

aivanovski opened this issue Sep 16, 2023 · 5 comments

Comments

@aivanovski
Copy link

XmlMapper just skips elements inside element with resource-id="com.ivanovsky.passnotes:id/recyclerView". File is attached.
There is also no warnings, errors or any kind messages after XmlMapper().readValue() call.

version 2.15.2

groups-screen-invalid-dump.xml.txt

@cowtowncoder
Copy link
Member

cowtowncoder commented Sep 19, 2023

@aivanovski This explanation is not sufficient to understand what your problem is -- please include code you are using, with expectations of what you thing should happen. Ideally in a form of a test case.
As is, I don't know what "Similar" here means, for example, nor why you think an expection ought to be thrown (Jackson does not use logging so no warnings would ever result).

@aivanovski
Copy link
Author

Some elements inside XML file aren't parsed, they are skipped during XmlMapper().readValue() call. These skipped elements are located inside element with resource-id="com.ivanovsky.passnotes:id/recyclerView" where resource-id is an XML attribute inside one of XML elements of the attached XML file.
@cowtowncoder

@pjfanning
Copy link
Member

Some elements inside XML file aren't parsed, they are skipped during XmlMapper().readValue() call. These skipped elements are located inside element with resource-id="com.ivanovsky.passnotes:id/recyclerView" where resource-id is an XML attribute inside one of XML elements of the attached XML file. @cowtowncoder

@aivanovski you haven't provided a meaningful example. There is no need to keep posting the same sparse details - they are not sufficient.

@aivanovski
Copy link
Author

aivanovski commented Sep 21, 2023

I supposed you guys at least try to parse attached file, but ok, that's honest enough. It's Kotlin. Inside the deserilized result (data variable), there is a node with resourceId=com.ivanovsky.passnotes:id/recyclerView it doesn't have a children, but xml file has children.

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonRootName
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule
import com.fasterxml.jackson.dataformat.xml.XmlMapper
import java.io.File

fun main(args: Array<String>) {
    val data = XmlMapper(JacksonXmlModule())
        .readValue(
            File("groups-screen-invalid-dump.xml.txt"),
            Hierarchy::class.java
        )
}

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonRootName("node")
class Node {
    @set:JsonProperty("resource-id", required = false)
    var resourceId: String? = null

    @set:JsonProperty("text", required = false)
    var text: String? = null

    @set:JsonProperty("node", required = false)
    var nodes: List<Node> = mutableListOf()
}

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonRootName("hierarchy")
class Hierarchy {
    @set:JsonProperty("rotation", required = false)
    var rotation: Int? = null

    @set:JsonProperty("node", required = false)
    var nodes: List<Node> = mutableListOf()
}

@aivanovski
Copy link
Author

Java code also has the same issue.
JacksonTestJava.java.txt

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

No branches or pull requests

3 participants