Skip to content

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

Description

@rambilde

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

Activity

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

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