*/
public Cursor convertSVGCursor(Element e, Value l) {
int nValues = l.getLength();
Element cursorElement = null;
for (int i=0; i<nValues-1; i++) {
Value cursorValue = l.item(i);
if (cursorValue.getPrimitiveType() == CSSPrimitiveValue.CSS_URI) {
String uri = cursorValue.getStringValue();
// If the uri does not resolve to a cursor element,
// then, this is not a type of cursor uri we can handle:
// go to the next or default to logical cursor
try {
cursorElement = ctx.getReferencedElement(e, uri);
} catch (BridgeException be) {
// Be only silent if this is a case where the target
// could not be found. Do not catch other errors (e.g,
// malformed URIs)
if (!ERR_URI_BAD_TARGET.equals(be.getCode())) {
throw be;
}
}
if (cursorElement != null) {
// We go an element, check it is of type cursor
String cursorNS = cursorElement.getNamespaceURI();
if (SVGConstants.SVG_NAMESPACE_URI.equals(cursorNS) &&
SVGConstants.SVG_CURSOR_TAG.equals
(cursorElement.getLocalName())) {
Cursor c = convertSVGCursorElement(cursorElement);
if (c != null) {
return c;
}
}
}
}
}
// If we got to that point, it means that no cursorElement
// produced a valid cursor, i.e., either a format we support
// or a valid referenced image (no broken image).
// Fallback on the built in cursor property.
Value cursorValue = l.item(nValues-1);
String cursorStr = SVGConstants.SVG_AUTO_VALUE;
if (cursorValue.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
cursorStr = cursorValue.getStringValue();
}
return convertBuiltInCursor(e, cursorStr);
}