// if we've gotten a filter, set up a transformer to support it
if (filter != null) {
if (tf == null)
tf = TransformerFactory.newInstance();
if (!tf.getFeature(SAXTransformerFactory.FEATURE))
throw new JspTagException(
Resources.getMessage("PARSE_NO_SAXTRANSFORMER"));
SAXTransformerFactory stf = (SAXTransformerFactory) tf;
th = stf.newTransformerHandler();
}
// produce a Document by parsing whatever the attributes tell us to use
Document d;
Object xmlText = this.xml;
if (xmlText == null) {
// if the attribute was specified, use the body as 'xml'
if (bodyContent != null && bodyContent.getString() != null)
xmlText = bodyContent.getString().trim();
else
xmlText = "";
}
if (xmlText instanceof String)
d = parseStringWithFilter((String) xmlText, filter);
else if (xmlText instanceof Reader)
d = parseReaderWithFilter((Reader) xmlText, filter);
else
throw new JspTagException(
Resources.getMessage("PARSE_INVALID_SOURCE"));
// we've got a Document object; store it out as appropriate
// (let any exclusivity or other constraints be enforced by TEI/TLV)
if (var != null)