At the root of the proposed schema is the Application element, while the elements mapping the eight basic types (Boolean, String, and Number types) are at the bottom.
This version of the code adds a Boolean variable, inElement, which ensures that textual content is only picked up specifically for the element being dealt with.