Class SchemaUtils

java.lang.Object
org.frankframework.validation.SchemaUtils

public class SchemaUtils extends Object
Author:
Michiel Meeuwissen, Jaco de Groot
  • Field Details

    • LOG

      protected static final org.apache.logging.log4j.Logger LOG
    • XSD

      public static final String XSD
      See Also:
    • SCHEMA

      public static final QName SCHEMA
    • ELEMENT

      public static final QName ELEMENT
    • IMPORT

      public static final QName IMPORT
    • INCLUDE

      public static final QName INCLUDE
    • REDEFINE

      public static final QName REDEFINE
    • TNS

      public static final QName TNS
    • ELFORMDEFAULT

      public static final QName ELFORMDEFAULT
    • SCHEMALOCATION

      public static final QName SCHEMALOCATION
    • NAMESPACE

      public static final QName NAMESPACE
    • NAME

      public static final QName NAME
    • WSDL_SCHEMA

      public static final QName WSDL_SCHEMA
  • Constructor Details

    • SchemaUtils

      public SchemaUtils()
  • Method Details

    • isElement

      public static boolean isElement(StartElement el, QName... names)
      Check if the StartElement is one of given qnames.
    • isElement

      public static boolean isElement(EndElement el, QName... names)
      Check if the EndElement is one of given qnames.
    • isName

      public static boolean isName(QName elementName, QName... names)
      Check if the elementName is one of given qnames.
    • groupXsdsByNamespace

      public static Map<String, Set<IXSD>> groupXsdsByNamespace(Set<IXSD> xsds, boolean sort)
      Group a set of XSDs by namespace. To recursively load all XSDs that are referenced from a starting set of XSDs, first call AbstractXSD.getXsdsRecursive(Set).
      Parameters:
      xsds - Set of XSDs to group.
      sort - Should the resulting map and set per namespace be sorted by namespace / resource XSD, or returned in order of input.
      Returns:
      A Map<String, Set<IXSD>> with XSDs grouped by namespace.
    • mergeRootXsdsGroupedByNamespaceToSchemasWithIncludes

      public static void mergeRootXsdsGroupedByNamespaceToSchemasWithIncludes(Map<String, Set<IXSD>> rootXsdsGroupedByNamespace, XMLStreamWriter xmlStreamWriter) throws XMLStreamException
      Throws:
      XMLStreamException
    • mergeXsdsGroupedByNamespaceToSchemasWithoutIncludes

      public static void mergeXsdsGroupedByNamespaceToSchemasWithoutIncludes(@NonNull IScopeProvider scopeProvider, @NonNull Map<String, Set<IXSD>> xsdsGroupedByNamespace, @NonNull XMLStreamWriter xmlStreamWriter) throws IOException, ConfigurationException
      Write merged XSDs to xmlStreamWriter from a map of XSDs grouped by namespace. This map can be created from groupXsdsByNamespace(Set, boolean). XSD <xsd:include/> tags will be skipped. To get a complete XSD in the output, call AbstractXSD.getXsdsRecursive(Set) on a set of input-XSDs before grouping them by namespace in a map.
      Throws:
      IOException
      ConfigurationException
    • mergeXsdsGroupedByNamespaceToSchemasWithoutIncludes

      public static @NonNull Set<IXSD> mergeXsdsGroupedByNamespaceToSchemasWithoutIncludes(IScopeProvider scopeProvider, Map<String, Set<IXSD>> xsdsGroupedByNamespace) throws XMLStreamException, IOException, ConfigurationException
      Returns merged XSDs from a map of XSDs grouped by namespace. This map can be created from groupXsdsByNamespace(Set, boolean). XSD <xsd:include/> tags will be skipped. To get a complete XSD in the output, call AbstractXSD.getXsdsRecursive(Set) on a set of input-XSDs before grouping them by namespace in a map.
      Returns:
      merged XSDs
      Throws:
      XMLStreamException
      IOException
      ConfigurationException
    • writeStandaloneXsd

      public static void writeStandaloneXsd(@NonNull IXSD xsd, @NonNull XMLStreamWriter xmlStreamWriter) throws IOException, ConfigurationException
      Write the XSD out to the XMLStreamWriter as a standalone XSD.
      Parameters:
      xsd - XSD to be written
      xmlStreamWriter - Target XMLStreamWriter
      Throws:
      IOException - When reading or writing fails
      ConfigurationException - When there was an exception in the XML
    • toReader

      public static Reader toReader(javax.wsdl.Definition wsdlDefinition, javax.wsdl.extensions.schema.Schema wsdlSchema) throws javax.wsdl.WSDLException
      Throws:
      javax.wsdl.WSDLException
    • toString

      public static String toString(javax.wsdl.Definition wsdlDefinition, javax.wsdl.extensions.schema.Schema wsdlSchema) throws javax.wsdl.WSDLException
      Throws:
      javax.wsdl.WSDLException
    • sortByDependencies

      public static void sortByDependencies(Set<IXSD> xsds, List<Schema> schemas)