Need help for pasing a xml file

How do you deal with that in the night, when the value is not available? Today I got a lot of error messages in my home assistant log. But I like to get rid of them.

Thanks a lot for this example, I had to try out a lot and read also the documentation, but in the end this was quit simple - the _Value didn’t work for me - it had to be @Value

rest:
  - scan_interval: 5
    resource: http://192.168.1.111/measurements.xml
    sensor:
      - name: "Kostal-Erzeugung"
        value_template: "{{ value_json.root.Device.Measurements.Measurement[2]['@Value'] }}"
        device_class: "power"
        unit_of_measurement: "W"