Fix #1297 "XML Schema service: NPE if section id ends with "-section""

- use section id directly as we have the element
- also refactor code to make it a bit easier to understand