com.oxygenxml.validate.nvdl
Class NamespaceSpecification

java.lang.Object
  extended by com.oxygenxml.validate.nvdl.NamespaceSpecification

 class NamespaceSpecification
extends Object

Stores information about a namespace specification. A namespace is specified with a namespace pattern and a wildcard. The wildcard can be present in multiple places in the namespace specification and each occurence of the wildcard can be replaced with an arbitrary sequence of characters.

Author:
george

Field Summary
(package private) static String ANY_NAMESPACE
          Constant for any namespace.
static String DEFAULT_WILDCARD
          Default value for wildcard.
(package private)  String ns
          The namespace pattern, may contain one or more occurances of the wildcard.
(package private)  String wildcard
          The wildcard character, by default it is *.
 
Constructor Summary
NamespaceSpecification(String ns)
          Creates a namespace specification from a namespace pattern using the default wildcard, that is *.
NamespaceSpecification(String ns, String wildcard)
          Creates a namespace specification from a namespace pattern and a given wildcard.
 
Method Summary
 boolean compete(NamespaceSpecification n)
          Check if this namespace specification competes with another namespace specification.
 boolean covers(String uri)
          Checks if a namespace specification covers a specified URI.
 boolean equals(Object obj)
          Checks for equality with another Namespace specification.
 int hashCode()
          Get a hashcode for this namespace specification.
private  String[] split(String value, String regexp)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WILDCARD

public static String DEFAULT_WILDCARD
Default value for wildcard.


ANY_NAMESPACE

static final String ANY_NAMESPACE
Constant for any namespace.

See Also:
Constant Field Values

ns

String ns
The namespace pattern, may contain one or more occurances of the wildcard.


wildcard

String wildcard
The wildcard character, by default it is *.

Constructor Detail

NamespaceSpecification

public NamespaceSpecification(String ns)
Creates a namespace specification from a namespace pattern using the default wildcard, that is *.

Parameters:
ns - The namespace pattern

NamespaceSpecification

public NamespaceSpecification(String ns,
                              String wildcard)
Creates a namespace specification from a namespace pattern and a given wildcard.

Parameters:
ns - The namespace pattern
wildcard - The given wildcard character.
Method Detail

compete

public boolean compete(NamespaceSpecification n)
Check if this namespace specification competes with another namespace specification.

Parameters:
n - The namespace specification we need to check if it competes with this namespace specification.
Returns:
true if the namespace specifications compete.

split

private String[] split(String value,
                       String regexp)

covers

public boolean covers(String uri)
Checks if a namespace specification covers a specified URI. any namespace pattern covers only the any namespace uri.

Parameters:
uri - The uri to be checked.
Returns:
true if the namespace pattern covers the specified uri.

equals

public boolean equals(Object obj)
Checks for equality with another Namespace specification.

Overrides:
equals in class Object

hashCode

public int hashCode()
Get a hashcode for this namespace specification.

Overrides:
hashCode in class Object