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

java-xml/PrintAllHandlerSax incorrect handling of nested nodes #8

Open
rambilde opened this issue Oct 3, 2023 · 0 comments
Open

java-xml/PrintAllHandlerSax incorrect handling of nested nodes #8

rambilde opened this issue Oct 3, 2023 · 0 comments

Comments

@rambilde
Copy link

rambilde commented Oct 3, 2023

When you add printing value of staff node, it turns out that it has the value of the last nested node (bio):

@Override
    public void endElement(String uri,
                           String localName,
                           String qName) {
...
        if (qName.equalsIgnoreCase("staff")) {
            System.out.printf("staff : %s%n", currentValue.toString());
        }
}

console before:

End Element : bio
Bio : HTML tag <code>testing</code>
End Element : staff
Start Element : staff
Staff id : 1002

console after:

Bio : HTML tag <code>testing</code>
End Element : staff
staff : HTML tag <code>testing</code>
Start Element : staff
Staff id : 1002
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

1 participant