@Runtime public class NamespaceName extends Object implements Serializable
:
", related to a "default namespace"
==null
, neither input arguments
supplied by the user, nor values returned by retrieval methods.
They may indeed be ==""
, which normally stands for "non applicable".
org.xml.sax
.
==""
,
and can (typical XML idionsyncratics !-) only be mapped to the empty prefix
==""
.
validQName(String)
does no more, despite its name.
The check whether a prefix is an NameToken must be done by the caller,
explicitly, e.g. calling
NmTokenAttribute.checkNameToken(String)
.
The same holds for the ns-uri, use
Transformation.UriSyntaxCheck(String)
.
element(Map, String, boolean)
and attribute(Map, String, boolean)
, and the function based variants,
which receive an implementation of this mapping by a parameter.Modifier and Type | Field and Description |
---|---|
static String |
curlyBrace_close |
static String |
curlyBrace_open |
static String |
namespace_prefix_xml
The reserved prefix for the "xml:" namespace.
|
static String |
namespace_uri_xml
The reserved URI for the "xml:" namespace.
|
static char |
prefixSeparator |
Constructor and Description |
---|
NamespaceName(String qname)
Create a NamespaceName representing an identifier not in namespace mode.
|
NamespaceName(String namespaceURI,
String localName)
Create a NamespaceName with the given URI and the given localname.
|
NamespaceName(String namespaceURI,
String prefix,
String localName)
Create a NamespaceName with the given URI and the given localname,
and additionally memoize the prefix.
|
Modifier and Type | Method and Description |
---|---|
static NamespaceName |
attribute(Function<? super String,? extends String> namespaceMapping,
String qname)
Like above, but the prefix mapping is a function, non-namespace-mode not supported.
|
static NamespaceName |
attribute(Map<? extends String,? extends String> namespaceMapping,
String qname,
boolean namespacesEnabled)
Parsing function for a qualified name which stands for an attribute name.
|
static NamespaceName |
element(Function<? super String,? extends String> namespaceMapping,
String qname)
Like above, but the prefix mapping is a function, non-namespace-mode not supported.
|
static NamespaceName |
element(Map<? extends String,? extends String> namespaceMapping,
String qname,
boolean namespacesEnabled)
Parsing function for a qualified name which stands for an element name.
|
protected boolean |
equals(NamespaceName n)
Compares only namespaceURI and localname, prefix is irrelevant.
|
boolean |
equals(Object o) |
String |
getLocalName()
Local names are only defined in namespace mode.
|
boolean |
getNamespacesEnabled() |
String |
getNamespaceURI() |
String |
getPrefix() |
String |
getQName() |
int |
hashCode() |
boolean |
matches(String namespaceURI,
String localName,
String qname)
Behaves like
equals(NamespaceName) , but without
explicitly contructing an instance of NamespaceName! Is used
for comparing "this" to a triple of Strings a produced by the
sax project api. |
static NamespaceName |
parseInlineURIFormat(String s)
Parse the input in the "curly brace" syntax of an "universal name".
|
String |
toString()
Render this to a string in the "curly brace" format, similar to a "universal name".
|
String |
universalName()
Render this to a string in the "curly brace" format of a "universal name".
|
static @Opt String[] |
validQName(String qname)
Check for validity of a qualified name and split into its two components.
|
public static final char prefixSeparator
public static final String curlyBrace_open
public static final String curlyBrace_close
public static final String namespace_prefix_xml
public static final String namespace_uri_xml
public NamespaceName(String namespaceURI, String localName)
public NamespaceName(String namespaceURI, String prefix, String localName)
getQName()
and toString()
) the prefix will be ignored.public NamespaceName(String qname)
http://www.w3.org/TR/xhtml1/
,
not those of .qname
- a name containing arbitrary many colons, but not considered in namespace
mode. It will be returned by getQName()
.public String getNamespaceURI()
public String getLocalName()
getQName()
instead.//FIXME SINNVOLL??public String getPrefix()
public String getQName()
public boolean getNamespacesEnabled()
public String toString()
public String universalName()
protected boolean equals(NamespaceName n)
public static NamespaceName parseInlineURIFormat(String s) throws IllegalArgumentException
{http://myUri}element
IllegalArgumentException
public boolean matches(String namespaceURI, String localName, String qname)
equals(NamespaceName)
, but without
explicitly contructing an instance of NamespaceName! Is used
for comparing "this" to a triple of Strings a produced by the
sax project api.
Currently it is used by
eu.bandm.tools.util.SAXEventQueue.Event#lookaheadTag(NamespaceName)
@Opt public static @Opt String[] validQName(String qname)
NmTokenAttribute.checkNameToken(String)
must be called, which is not yet compiled when this is compiled. (in the current
metatools Makefile boot process).public static NamespaceName element(Map<? extends String,? extends String> namespaceMapping, String qname, boolean namespacesEnabled) throws IllegalArgumentException
namespacesEnabled==true
, there must be at most one
colon ":
", and if there is, it separates prefix and localname.
Otherwise the prefix is the empty string.
EVERY prefix (incl. the empty string) is looked up in the map to determine the URI.
Any non-empty prefix unsuccessfully looked for in the map generates an
IllegalArgumentException; the empty prefix not in the map maps to the empty URI.
Iff namespacesEnabled==false
, the qname argument is treated
as a local name, as a whole.namespaceMapping
- map from prefices to URIs
(empty string as a key=prefix represents what is called "default namespace")qname
- String to parsenamespacesEnabled
- whether to treat colon speciallyIllegalArgumentException
public static NamespaceName attribute(Map<? extends String,? extends String> namespaceMapping, String qname, boolean namespacesEnabled) throws IllegalArgumentException
namespacesEnabled==true
, there must be at most one
colon ":
", and if there is, it separates a non-empty prefix and
a non-empty localname.
If there is no colon, the prefix is the empty string.IllegalArgumentException
.namespacesEnabled==false
, the qname argument is treated
as a local name, as a whole.namespaceMapping
- map from prefices to URIsqname
- String to parsenamespacesEnabled
- whether to treat colon speciallyIllegalArgumentException
public static NamespaceName element(Function<? super String,? extends String> namespaceMapping, String qname) throws IllegalArgumentException
IllegalArgumentException
- iff illegal colon positions or prefix not in map.public static NamespaceName attribute(Function<? super String,? extends String> namespaceMapping, String qname) throws IllegalArgumentException
IllegalArgumentException
- iff illegal colon positions or prefix not in map.see also the complete user documentation .