public CSSValue parse(Reader r, String ns, String ln)
throws ParseException {
ns = (ns == null) ? "" : ns;
Map m = (Map)factories.get(ns);
if (m == null) {
throw new ParseException
(formatMessage("unknown.attribute",
new Object[] { ns, ln }),
-1, -1);
}
CSSValueFactory f = (CSSValueFactory)m.get(ln);
if (f == null) {
throw new ParseException
(formatMessage("unknown.attribute",
new Object[] { ns, ln }),
-1, -1);
}
try {
LexicalUnit lu = parser.parsePropertyValue(new InputSource(r));
return f.createCSSValue(lu);
} catch (Exception e) {
e.printStackTrace();
throw new ParseException
(formatMessage("parser.exception",
new Object[] { e.getMessage() }),
e);
}
}