org.fourthline.cling.binding.xml

## Class RecoveringUDA10DeviceDescriptorBinderImpl

- java.lang.Object
- - org.fourthline.cling.binding.xml.UDA10DeviceDescriptorBinderImpl
  - - org.fourthline.cling.binding.xml.RecoveringUDA10DeviceDescriptorBinderImpl

- All Implemented Interfaces:
    DeviceDescriptorBinder, ErrorHandler

      public class RecoveringUDA10DeviceDescriptorBinderImpl
      extends UDA10DeviceDescriptorBinderImpl

  Author:
    Michael Pujos

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecoveringUDA10DeviceDescriptorBinderImpl()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<D extends Device> D` | `describe(D undescribedDevice, String descriptorXml)`
    `protected String` | `fixGarbageTrailingChars(String descriptorXml, DescriptorBindingException ex)`
    `protected String` | `fixMissingNamespaces(String descriptorXml, DescriptorBindingException ex)`
    `protected void` | `handleInvalidDescriptor(String xml, DescriptorBindingException exception)` Handle processing errors while reading XML descriptors.
    `protected <D extends Device> D` | `handleInvalidDevice(String xml, D device, ValidationException exception)` Handle processing errors while binding XML descriptors.

    - ### Methods inherited from class org.fourthline.cling.binding.xml.UDA10DeviceDescriptorBinderImpl

      `buildDOM, buildInstance, describe, error, fatalError, generate, generateDevice, generateDeviceList, generateIconList, generateRoot, generateServiceList, generateSpecVersion, hydrateDevice, hydrateDeviceList, hydrateIconList, hydrateRoot, hydrateServiceList, hydrateSpecVersion, parseURI, warning`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RecoveringUDA10DeviceDescriptorBinderImpl

          public RecoveringUDA10DeviceDescriptorBinderImpl()

  - ### Method Detail

    - #### describe

          public <D extends Device> D describe(D undescribedDevice,
                                      String descriptorXml)
                                    throws DescriptorBindingException,
                                           ValidationException

      Specified by:
        `describe` in interface `DeviceDescriptorBinder`
      Overrides:
        `describe` in class `UDA10DeviceDescriptorBinderImpl`
      Throws:
        `DescriptorBindingException`
        `ValidationException`

    - #### fixGarbageTrailingChars

          protected String fixGarbageTrailingChars(String descriptorXml,
                                       DescriptorBindingException ex)

    - #### fixMissingNamespaces

          protected String fixMissingNamespaces(String descriptorXml,
                                    DescriptorBindingException ex)

    - #### handleInvalidDescriptor

          protected void handleInvalidDescriptor(String xml,
                                     DescriptorBindingException exception)
                                          throws DescriptorBindingException

      Handle processing errors while reading XML descriptors.

      Typically you want to log this problem or create an error report, and in any case, throw a `DescriptorBindingException` to notify the caller of the binder of this failure. The default implementation simply rethrows the given exception.

      Parameters:
        `xml` - The original XML causing the parsing failure.
        `exception` - The original exception while parsing the XML.
      Throws:
        `DescriptorBindingException`

    - #### handleInvalidDevice

          protected <D extends Device> D handleInvalidDevice(String xml,
                                                 D device,
                                                 ValidationException exception)
                                                  throws ValidationException

      Handle processing errors while binding XML descriptors.

      Typically you want to log this problem or create an error report. You should throw a `ValidationException` to notify the caller of the binder of failure. The default implementation simply rethrows the given exception.

      This method gives you a final chance to fix the problem, instead of throwing an exception, you could try to create valid `Device` model and return it.

      Parameters:
        `xml` - The original XML causing the binding failure.
        `device` - The unfinished `Device` that failed validation
        `exception` - The errors found when validating the `Device` model.
      Returns:
        Device A "fixed" `Device` model, instead of throwing an exception.
      Throws:
        `ValidationException`

Copyright © 2014 4th Line GmbH, Switzerland. All Rights Reserved.