Methods Summary |
---|
public java.util.Enumeration | getAllPrefixes()
int count = 0;
if (fPrefixes.length < (fNamespace.length / 2)) {
// resize prefix array
String[] prefixes = new String[fNamespaceSize];
fPrefixes = prefixes;
}
String prefix = null;
boolean unique = true;
for (int i = fContext[fScope[fCurrentScope]];
i <= (fNamespaceSize - 2);
i += 2) {
prefix = fNamespace[i];
for (int k = 0; k < count; k++) {
if (fPrefixes[k] == prefix) {
unique = false;
break;
}
}
if (unique) {
fPrefixes[count++] = prefix;
}
unique = true;
}
return new Prefixes(fPrefixes, count);
|
public java.lang.String | getPrefix(java.lang.String uri)
return getPrefix(uri, fNamespaceSize, fContext[fScope[fCurrentScope]]);
|
public java.lang.String | getPrefix(java.lang.String uri, int context)
return getPrefix(uri, fContext[context+1], fContext[fScope[getScopeForContext(context)]]);
|
public java.lang.String | getPrefix(java.lang.String uri, int start, int end)
// this saves us from having a copy of each of these in fNamespace for each scope
if (uri == NamespaceContext.XML_URI) {
return XMLSymbols.PREFIX_XML;
}
if (uri == NamespaceContext.XMLNS_URI) {
return XMLSymbols.PREFIX_XMLNS;
}
// find uri in current context
for (int i = start; i > end; i -= 2) {
if (fNamespace[i - 1] == uri) {
if (getURI(fNamespace[i - 2]) == uri)
return fNamespace[i - 2];
}
}
// uri not found
return null;
|
public int | getScopeForContext(int context)
int scope = fCurrentScope;
while (context < fScope[scope]) {
scope--;
}
return scope;
|
public java.lang.String | getURI(java.lang.String prefix, int start, int end)
// this saves us from having a copy of each of these in fNamespace for each scope
if (prefix == XMLSymbols.PREFIX_XML) {
return NamespaceContext.XML_URI;
}
if (prefix == XMLSymbols.PREFIX_XMLNS) {
return NamespaceContext.XMLNS_URI;
}
// find prefix in current context
for (int i = start; i > end; i -= 2) {
if (fNamespace[i - 2] == prefix) {
return fNamespace[i - 1];
}
}
// prefix not found
return null;
|
public java.lang.String | getURI(java.lang.String prefix)
return getURI(prefix, fNamespaceSize, fContext[fScope[fCurrentScope]]);
|
public java.lang.String | getURI(java.lang.String prefix, int context)
return getURI(prefix, fContext[context+1], fContext[fScope[getScopeForContext(context)]]);
|
public void | popScope()Pops the current scope. The namespace bindings from the new current scope
are then used for searching for namespaces and prefixes.
fCurrentContext = fScope[fCurrentScope--];
popContext();
|
public void | pushScope()Begins a new scope. None of the previous namespace bindings will be used,
until the new scope is popped with popScope()
if (fCurrentScope + 1 == fScope.length) {
int[] contextarray = new int[fScope.length * 2];
System.arraycopy(fScope, 0, contextarray, 0, fScope.length);
fScope = contextarray;
}
pushContext();
fScope[++fCurrentScope] = fCurrentContext;
|
public void | reset()Only resets the current scope -- all namespaces defined in lower scopes
remain valid after a call to reset.
fCurrentContext = fScope[fCurrentScope];
fNamespaceSize = fContext[fCurrentContext];
|