Class SchemaUtils


  • public class SchemaUtils
    extends Object
    Utility methods for working with schema structures.
    Author:
    Dennis M. Sosnoski
    • Field Detail

      • XS_PREFIX_BINDING

        public static final String XS_PREFIX_BINDING
        Binding name for output with schema namespace prefix 'xs'.
        See Also:
        Constant Field Values
      • NO_PREFIX_BINDING

        public static final String NO_PREFIX_BINDING
        Binding name for output with schema namespace as default (no prefix).
        See Also:
        Constant Field Values
      • s_logger

        public static final org.apache.log4j.Logger s_logger
        Logger for class.
    • Constructor Detail

      • SchemaUtils

        public SchemaUtils()
    • Method Detail

      • isRepeated

        public static boolean isRepeated​(IArity part)
        Check if a particle is a repeated value.
        Parameters:
        part - particle to be checked
        Returns:
        true if repeated, false if not
      • isProhibited

        public static boolean isProhibited​(IArity part)
        Check if a particle is prohibited (no instances allowed).
        Parameters:
        part - particle to be checked
        Returns:
        true if prohibited, false if not
      • isOptional

        public static boolean isOptional​(IArity part)
        Check if a particle is optional (zero instances allowed).
        Parameters:
        part - particle to be checked
        Returns:
        true if optional, false if not
      • isOptionalElement

        public static boolean isOptionalElement​(ElementElement elem)
        Check if an element is optional (zero instances allowed).
        Parameters:
        elem - element to be checked
        Returns:
        true if optional, false if not
      • isOptionalAttribute

        public static boolean isOptionalAttribute​(AttributeElement attr)
        Check if an attribute is optional (zero instances allowed).
        Parameters:
        attr - attribute to be checked
        Returns:
        true if optional, false if not
      • isSingleton

        public static boolean isSingleton​(IArity part)
        Check if a particle is a singleton (one, and only one, instance allowed).
        Parameters:
        part - particle to be checked
        Returns:
        true if singleton, false if not
      • isSingletonElement

        public static boolean isSingletonElement​(ElementElement elem)
        Check if an element is a singleton (one, and only one, instance allowed).
        Parameters:
        elem - element to be checked
        Returns:
        true if singleton, false if not
      • isNillable

        public static boolean isNillable​(OpenAttrBase comp)
        Check if a definition component is nillable (an element with nillable='true').
        Parameters:
        comp - Component
        Returns:
        true if nillable, false if not
      • isNamed

        public static boolean isNamed​(OpenAttrBase comp)
        Check if a definition component has a name.
        Parameters:
        comp - Component
        Returns:
        true if named, false if not
      • getIndentation

        public static String getIndentation​(int depth)
        Get indentation string. This returns a string of the requested number of indents to the maximum value supported, and otherwise just returns the maximum indentation.
        Parameters:
        depth - Indentation depth
        Returns:
        indentation string
      • describeComponent

        public static String describeComponent​(SchemaBase comp)
        Get string description of component for use in logging.
        Parameters:
        comp - schema component
        Returns:
        description
      • componentPath

        public static String componentPath​(OpenAttrBase comp)
        Get path to component.
        Parameters:
        comp - schema component
        Returns:
        description
      • isEnumeration

        public static boolean isEnumeration​(AnnotatedBase comp)
        Check if a particular schema definition component is an enumeration type definition. Formally, this returns true if and only if the component is a <simpleType> element which is a restriction using one or more <enumeration> facets.
        Parameters:
        comp - Component
        Returns:
        true if an enumeration definition, false if not