XSNamedMapImplpublic class XSNamedMapImpl extends Object implements XSNamedMapContaints the map between qnames and XSObject's. |
Fields Summary |
---|
String[] | fNamespaces | int | fNSNum | SymbolHash[] | fMaps | XSObject[] | fArray | int | fLength | QName | fName |
Constructors Summary |
---|
public XSNamedMapImpl(String namespace, SymbolHash map)Construct an XSNamedMap implmentation for one namespace
fNamespaces = new String[] {namespace};
fMaps = new SymbolHash[] {map};
fNSNum = 1;
| public XSNamedMapImpl(String[] namespaces, SymbolHash[] maps, int num)Construct an XSNamedMap implmentation for a list of namespaces
fNamespaces = namespaces;
fMaps = maps;
fNSNum = num;
| public XSNamedMapImpl(XSObject[] array, int length)Construct an XSNamedMap implmentation one namespace from an array
if (length == 0) {
fNSNum = 0;
fLength = 0;
return;
}
// because all components are from the same target namesapce,
// get the namespace from the first one.
fNamespaces = new String[]{array[0].getNamespace()};
fMaps = null;
fNSNum = 1;
// copy elements to the Vector
fArray = array;
fLength = length;
|
Methods Summary |
---|
public synchronized int | getLength()The number of XSObjects in the XSObjectList . The
range of valid child node indices is 0 to length-1
inclusive.
if (fLength == -1) {
fLength = 0;
for (int i = 0; i < fNSNum; i++)
fLength += fMaps[i].getLength();
}
return fLength;
| public synchronized com.sun.org.apache.xerces.internal.xs.XSObject | item(int index)Returns the index th item in the map. The index starts at
0. If index is greater than or equal to the number of
nodes in the list, this returns null .
if (fArray == null) {
// calculate the total number of elements
getLength();
fArray = new XSObject[fLength];
int pos = 0;
// get components from all SymbolHash's
for (int i = 0; i < fNSNum; i++) {
pos += fMaps[i].getValues(fArray, pos);
}
}
if (index < 0 || index >= fLength)
return null;
return fArray[index];
| public com.sun.org.apache.xerces.internal.xs.XSObject | itemByName(java.lang.String namespace, java.lang.String localName)Retrieves an XSObject specified by local name and namespace
URI.
if (namespace != null)
namespace = namespace.intern();
for (int i = 0; i < fNSNum; i++) {
if (namespace == fNamespaces[i]) {
// when this map is created from SymbolHash's
// get the component from SymbolHash
if (fMaps != null)
return (XSObject)fMaps[i].get(localName);
// Otherwise (it's created from an array)
// go through the array to find a matcing name
XSObject ret;
for (int j = 0; j < fLength; j++) {
ret = fArray[j];
if (ret.getName().equals(localName))
return ret;
}
return null;
}
}
return null;
|
|