Class NameSpaces


  • public final class NameSpaces
    extends Object
    Mapping from XML prefixes or Java types to programmatic namespaces (modules or packages). There is not necessarily a one-to-one relationship between XML namespaces, Java packages or Python modules. For example we may merge some XML namespaces in a single programmatic namespace if keeping them separated would result in modules or packages with few classes.
    Since:
    3.1
    • Constructor Detail

      • NameSpaces

        public NameSpaces()
        Creates a new mapping from XML namespaces (identified by prefixes) to programmatic namespaces.
    • Method Detail

      • exclude

        public void exclude​(String... prefixes)
        Excludes the namespaces identified by the given prefixes. Calls to name(Class, Map) for a type in the namespace identified by one of the given prefixes will return null.
        Parameters:
        prefixes - identifications of the namespaces to exclude.
      • name

        public QName name​(Class<?> type,
                          Map<String,​SchemaInformation.Element> definition)
        Returns the OGC/ISO name of the given type together with its XML prefix and pseudo-namespace, or null. Note that while we use the QName object for convenience, this is not the XML name:
        • QName.getLocalPart() will be the OGC/ISO name, which is usually the same than the XML local part but not always.
        • QName.getPrefix() will be the XML prefix if known, or the UML prefix otherwise. May be empty is no prefix can be inferred.
        • QName.getNamespaceURI() will be the programmatic namespace. This may be a fragment of the XML namespace but never the full URI.
        Parameters:
        type - the type for which to get the namespace, or null.
        definition - value of SchemaInformation.getTypeDefinition(Class) for the given type, or null if unknown.
        Returns:
        the OGC/ISO name, prefix and pseudo-namespace for the given type, or null if none.
      • packages

        public Set<Stringpackages()
        Returns all namespace values that may be returned by name(Class, Map). This method returns a modifiable set. Modifications to the returned set will not affect this NameSpaces instance.
        Returns:
        all package names known to this NameSpaces instance.