}
else
expression = (DOMXPath)query.getPreparedQuery();
// Access cached xsl transformation
XslTransformer xslContentTransformer = null;
if (this.xslContentTransformerFileName != null) {
xslContentTransformer = (XslTransformer)query.getTransformer();
if (xslContentTransformer == null) {
Map xslProps = new TreeMap(); // TODO: Where to get them from
xslContentTransformer = new XslTransformer(glob, this.xslContentTransformerFileName, null, null, xslProps);
}
}
String xml = getXml(msgUnit).trim(); // Content or QoS
if (xml.length() == 0) {
log.warning("Provided XML string is empty, query does not match.");
return false;
}
Document doc = null;
try {
doc = getDocument(msgUnit);
}
catch (Throwable e) {
log.warning("The msgUnit can't be parsed, we reject it for this subscriber: " + e.toString());
return false;
}
if ( log.isLoggable(Level.FINEST))
log.finest("Matching query " + query.getQuery() + " against document: " + getXml(msgUnit));
boolean match = expression.booleanValueOf(doc);
if (log.isLoggable(Level.FINE))
log.fine("Query "+query.getQuery()+" did" + (match ? " match" : " not match"));
if (match == true && xslContentTransformer != null) {
String tmp = (this.matchAgainstQos) ? msgUnit.getContentStr() : xml;
String ret = xslContentTransformer.doXSLTransformation(tmp);
msgUnit.setContent(ret.getBytes());
}
return match;
}