The tag-sequence "<switch><state></state>...</switch>" is mapped with the class SwitchState. The object may be null sometimes. The method Device().getSwitchState() currently requires it to be instantiated. Null is checked with SwitchState().isNull().