Class DefaultXmlProblemHandler

java.lang.Object
dev.metaschema.databind.io.AbstractProblemHandler
dev.metaschema.databind.io.xml.DefaultXmlProblemHandler
All Implemented Interfaces:
IProblemHandler, IXmlProblemHandler

public class DefaultXmlProblemHandler extends AbstractProblemHandler implements IXmlProblemHandler
Handles problems identified in the parsed XML.

The default problem handler will report unknown attributes, and provide empty collections for multi-valued model items and default values for flags and single valued fields.

  • Constructor Details

    • DefaultXmlProblemHandler

      public DefaultXmlProblemHandler()
      Construct a new problem handler with required field validation enabled.
    • DefaultXmlProblemHandler

      public DefaultXmlProblemHandler(boolean validateRequiredFields)
      Construct a new problem handler with the specified validation setting.
      Parameters:
      validateRequiredFields - true to validate that required fields are present, false to skip validation
  • Method Details

    • handleUnknownAttribute

      public boolean handleUnknownAttribute(IBoundDefinitionModelComplex parentDefinition, IBoundObject targetObject, Attribute attribute, IXmlParsingContext parsingContext)
      Description copied from interface: IXmlProblemHandler
      Callback used to handle an attribute that is unknown to the model being parsed.
      Specified by:
      handleUnknownAttribute in interface IXmlProblemHandler
      Parameters:
      parentDefinition - the bound class currently describing the data being parsed
      targetObject - the Java object for the parentDefinition
      attribute - the unknown attribute
      parsingContext - the XML parsing context used for parsing
      Returns:
      true if the attribute was handled by this method, or false otherwise