sk.uniba.euromath.document.schema
Interface INameList<T extends BaseRule>

Type Parameters:
T - the rule type. Can be instance of AttributeRule or NewElementRule only.
All Known Implementing Classes:
NameListCustom

public interface INameList<T extends BaseRule>

Maintains list of all creatable elements/attributes.

Author:
Martin Vysny

Method Summary
 boolean acceptsNamespace(String namespaceURI)
          Checks if the namelist accepts/contains at least one qname from given namespace.
 Set<QName> getForeignNames()
          Returns set of all foreign names, that are in this namelist.
 Set<String> getLocalNames()
          Returns set of all localnames, that are in this namelist.
 Set<String> getNamespaces()
          Tries to obtain a list of namespaces of qnames that are contained in this name list.
 String getNamespaceUri()
          Returns schema's namespace.
 T getRule(QName foreign)
          Returns rule, that can be used to create node content.
 T getRule(QName qname, boolean isElement)
          Returns rule, that can be used to create node content.
 T getRule(String localName)
          Returns rule, that can be used to create node content.
 boolean hasRule(QName qname, boolean isElement)
          Checks if this namelist contains given qname.
 boolean isEmpty()
          Checks if this namelist is empty (it contains no rules).
 boolean isLocal(QName qname, boolean isElement)
          Checks if given qname is local.
 void refresh()
          Refreshes the namelist to reflect the schema loading/unloading.
 

Method Detail

getLocalNames

Set<String> getLocalNames()
Returns set of all localnames, that are in this namelist. This set must not be modified.

Returns:
set of Strings.

getForeignNames

Set<QName> getForeignNames()
Returns set of all foreign names, that are in this namelist. This set must not be modified. There are only qnames from loaded schemas - unloaded schemas can be represented by their namespaces and loaded when required.

Returns:
set of QName

isEmpty

boolean isEmpty()
Checks if this namelist is empty (it contains no rules).

Returns:
true if this namelist is empty.

getRule

T getRule(String localName)
Returns rule, that can be used to create node content.

Parameters:
localName - local name of node (element or attribute).
Returns:
rule, that can be used to create node content. If node is attribute, then returned value is of type AttributeRule, else it is of type NewElementRule.
Throws:
IllegalArgumentException - if given qname is not known.

getRule

T getRule(QName foreign)
Returns rule, that can be used to create node content.

Parameters:
foreign - full name of foreign (not from our namespace) node (element or attribute).
Returns:
rule, that can be used to create node content. If node is attribute, then returned value is of type AttributeRule, else it is of type NewElementRule.
Throws:
IllegalArgumentException - if given qname is not known.

getRule

T getRule(QName qname,
          boolean isElement)
Returns rule, that can be used to create node content. It automatically detects between local and foreign rule.

Parameters:
qname - full name of node (element or attribute).
isElement - true if the namelist represents element rules, false if attribute rules.
Returns:
rule, that can be used to create node content. If node is attribute, then returned value is of type AttributeRule, else it is of type NewElementRule.
Throws:
IllegalArgumentException - if given qname is not known.

hasRule

boolean hasRule(QName qname,
                boolean isElement)
Checks if this namelist contains given qname. It automatically detects between local and foreign rule.

Parameters:
qname - full name of node (element or attribute).
isElement - true if the namelist represents element rules, false if attribute rules.
Returns:
true if given qname is known and there is a rule for it, false otherwise.

isLocal

boolean isLocal(QName qname,
                boolean isElement)
Checks if given qname is local.

Parameters:
qname - full name of node (element or attribute).
isElement - true if the namelist represents element rules, false if attribute rules.
Returns:
true if given qname is local, false otherwise. It should implement the following algorithm: isElement ? DomTools.equalsURI(qname.getNamespaceURI(), getNamespaceUri()) : DomTools.equalsURI( qname.getNamespaceURI(), null);

getNamespaceUri

String getNamespaceUri()
Returns schema's namespace.

Returns:
base namespace of schema, that created this object.

getNamespaces

Set<String> getNamespaces()
Tries to obtain a list of namespaces of qnames that are contained in this name list. If the set cannot be computed then return null.

Returns:
namespaces of items contained in the namelist, or null if it cannot be computed and/or represented. null namespace is represented as an empty string.

acceptsNamespace

boolean acceptsNamespace(String namespaceURI)
Checks if the namelist accepts/contains at least one qname from given namespace.

Parameters:
namespaceURI - the namespace to check.
Returns:
true if the namelist accepts at least one qname with given namespace.

refresh

void refresh()
Refreshes the namelist to reflect the schema loading/unloading.



Copyright © 2003-2006 null. All Rights Reserved.