|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensaml.xml.NamespaceManager
public class NamespaceManager
A class which is responsible for managing XML namespace-related data for an XMLObject
.
Code which mutates the state of an XMLObject such that XML namespace-related data is also logically changed, should call the appropriate method, based on the type of change being made.
Field Summary | |
---|---|
private Set<Namespace> |
attrNames
Registered namespaces of attribute names. |
private Map<String,Namespace> |
attrValues
Registered namespaces of attribute values. |
private Namespace |
contentValue
Registered namespaces of content values. |
private Set<Namespace> |
decls
Explicitly declared namespaces. |
static String |
DEFAULT_NS_TOKEN
The token used to represent the default namespace in getNonVisibleNamespacePrefixes() . |
private Namespace |
elementName
XMLObject name namespace. |
private Namespace |
elementType
XMLObject type namespace. |
private XMLObject |
owner
The owning XMLObject. |
private Set<Namespace> |
usage
Indeterminate namespace usage. |
private static Namespace |
XML_NAMESPACE
The 'xml' namespace. |
private static Namespace |
XSI_NAMESPACE
The 'xsi' namespace. |
Constructor Summary | |
---|---|
NamespaceManager(XMLObject owningObject)
Constructor. |
Method Summary | |
---|---|
private void |
addNamespace(Set<Namespace> namespaces,
Namespace newNamespace)
Add a Namespace to a set of Namespaces. |
private void |
addPrefixes(Set<String> prefixes,
Collection<Namespace> namespaces)
Add the prefixes from a collection of namespaces to a set of prefixes. |
private Namespace |
buildNamespace(QName name)
Build a Namespace instance from a QName . |
private boolean |
checkQName(QName name)
Check whether the supplied QName contains non-empty namespace info and should be managed by the namespace manager. |
private Namespace |
copyNamespace(Namespace orig)
Get a copy of a Namespace. |
void |
deregisterAttributeName(QName attributeName)
Deregister a namespace-qualified attribute name. |
void |
deregisterAttributeValue(String attributeID)
Deregister a QName attribute value. |
void |
deregisterContentValue()
Deregister a QName content value. |
void |
deregisterNamespace(Namespace namespace)
Deregister usage of a namespace in some indeterminate fashion. |
void |
deregisterNamespaceDeclaration(Namespace namespace)
Deregister a namespace declaration. |
static String |
generateAttributeID(QName name)
From an QName representing a qualified attribute name, generate an attribute ID suitable for use in registerAttributeValue(String, QName)
and deregisterAttributeValue(String) . |
Set<Namespace> |
getAllNamespacesInSubtreeScope()
Get the set of all namespaces which are in scope within the subtree rooted at the owning XMLObject. |
private Namespace |
getElementNameNamespace()
Return a Namespace instance representing the namespace of the element name. |
private Namespace |
getElementTypeNamespace()
Return a Namespace instance representing the namespace of the element type, if known. |
Set<Namespace> |
getNamespaces()
Get the set of namespaces currently in use on the owning XMLObject. |
private Set<Namespace> |
getNonVisibleNamespaceCandidates()
Get the set of non-visibly used namespaces used on the owning XMLObject (only the owner, not the owner's children). |
Set<String> |
getNonVisibleNamespacePrefixes()
Obtain the set of namespace prefixes used in a non-visible manner on owning XMLObject and its children. |
Set<Namespace> |
getNonVisibleNamespaces()
Obtain the set of namespaces used in a non-visible manner on owning XMLObject and its children. |
XMLObject |
getOwner()
Get the owning XMLObject instance. |
private Set<Namespace> |
getVisibleNamespaces()
Get the set of namespaces which are currently visibly-used on the owning XMLObject (only the owner, not its children). |
private Set<Namespace> |
mergeNamespaceCollections(Collection<Namespace>... namespaces)
Merge 2 or more Namespace collections into a single set, with equivalence semantics as described in addNamespace(Set, Namespace) . |
void |
registerAttributeName(QName attributeName)
Register a namespace-qualified attribute name. |
void |
registerAttributeValue(String attributeID,
QName attributeValue)
Register a QName attribute value. |
void |
registerContentValue(QName content)
Register a QName element content value. |
void |
registerElementName(QName name)
Register the owning XMLObject's element name. |
void |
registerElementType(QName type)
Register the owning XMLObject's element type, if explicitly declared via an xsi:type. |
void |
registerNamespace(Namespace namespace)
Register usage of a namespace in some indeterminate fashion. |
void |
registerNamespaceDeclaration(Namespace namespace)
Register a namespace declaration. |
private void |
removeNamespace(Set<Namespace> namespaces,
Namespace oldNamespace)
Remove a Namespace from a set of Namespaces. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_NS_TOKEN
getNonVisibleNamespacePrefixes()
.
private static final Namespace XML_NAMESPACE
private static final Namespace XSI_NAMESPACE
private XMLObject owner
private Namespace elementName
private Namespace elementType
private Set<Namespace> decls
private Set<Namespace> usage
private Set<Namespace> attrNames
private Map<String,Namespace> attrValues
private Namespace contentValue
Constructor Detail |
---|
public NamespaceManager(XMLObject owningObject)
owningObject
- the XMLObject whose namespace info is to be managedMethod Detail |
---|
public static String generateAttributeID(QName name)
registerAttributeValue(String, QName)
and deregisterAttributeValue(String)
.
name
- attribute name as a QName
public XMLObject getOwner()
public Set<Namespace> getNamespaces()
public void registerNamespace(Namespace namespace)
Other methods which indicate specific usage should be preferred over this one. This
method exists primarily for backward-compatibility support for XMLObject.addNamespace(Namespace)
.
namespace
- namespace to registerpublic void deregisterNamespace(Namespace namespace)
Other methods which indicate specific usage should be preferred over this one. This
method exists primarily for backward-compatibility support for XMLObject.removeNamespace(Namespace)
.
namespace
- namespace to deregisterpublic void registerNamespaceDeclaration(Namespace namespace)
namespace
- the namespace to registerpublic void deregisterNamespaceDeclaration(Namespace namespace)
namespace
- the namespace to deregisterpublic void registerAttributeName(QName attributeName)
attributeName
- the attribute name to registerpublic void deregisterAttributeName(QName attributeName)
attributeName
- the attribute name to deregisterpublic void registerAttributeValue(String attributeID, QName attributeValue)
attributeID
- unique identifier for the attribute within the XMLObject's content modelattributeValue
- the QName value to registerpublic void deregisterAttributeValue(String attributeID)
attributeID
- unique identifier for the attribute within the XMLObject's content modelpublic void registerContentValue(QName content)
content
- the QName value to registerpublic void deregisterContentValue()
public Set<String> getNonVisibleNamespacePrefixes()
The primary use case for this information is to support the inclusive prefixes information that may optionally be supplied as a part of XML exclusive canonicalization.
public Set<Namespace> getNonVisibleNamespaces()
The primary use case for this information is to support the inclusive prefixes information that may optionally be supplied as a part of XML exclusive canonicalization.
The Namespace instances themselves will be copied before being returned, so
modifications to them do not affect the actual Namespace instances in the
underlying tree. The original alwaysDeclare
property is not preserved.
public Set<Namespace> getAllNamespacesInSubtreeScope()
The Namespace instances themselves will be copied before being returned, so
modifications to them do not affect the actual Namespace instances in the
underlying tree. The original alwaysDeclare
property is not preserved.
public void registerElementName(QName name)
name
- the element name to registerpublic void registerElementType(QName type)
type
- the element type to registerprivate Namespace getElementNameNamespace()
private Namespace getElementTypeNamespace()
private Namespace buildNamespace(QName name)
Namespace
instance from a QName
.
name
- the source QName
private void addNamespace(Set<Namespace> namespaces, Namespace newNamespace)
alwaysDeclare
property of true will take precedence over a value of false.
namespaces
- the set of namespacesnewNamespace
- the namespace to add to the setprivate void removeNamespace(Set<Namespace> namespaces, Namespace oldNamespace)
alwaysDeclare
property will be ignored for
purpose of equivalence.
namespaces
- the set of namespacesoldNamespace
- the namespace to add to the setprivate Set<Namespace> mergeNamespaceCollections(Collection<Namespace>... namespaces)
addNamespace(Set, Namespace)
.
namespaces
- list of Namespaces to merge
private Set<Namespace> getVisibleNamespaces()
Namespaces returned in the set are copied from the ones held in the manager. The
alwaysDeclare
property is not preserved.
private Set<Namespace> getNonVisibleNamespaceCandidates()
Namespaces returned in the set are copied from the ones held in the manager. The
alwaysDeclare
property is not preserved.
private Namespace copyNamespace(Namespace orig)
alwaysDeclare
property is not preserved.
orig
- the namespace instance to copy
private void addPrefixes(Set<String> prefixes, Collection<Namespace> namespaces)
DEFAULT_NS_TOKEN
.
prefixes
- the set of prefixes to which to addnamespaces
- the source set of Namespacesprivate boolean checkQName(QName name)
name
- the QName to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |