@ Override public int doEndTag ( ) throws JspException { // produce a Document by parsing whatever the attributes tell us to use 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 ) { xmlText = new StringReader ( ( String ) xmlText ) ; } if ( ! ( xmlText instanceof Reader ) ) { throw new JspTagException ( Resources . getMessage ( "PARSE_INVALID_SOURCE" ) ) ; } InputSource source = XmlUtil . newInputSource ( ( ( Reader ) xmlText ) , systemId ) ; Document d ; if ( filter != null ) { d = parseInputSourceWithFilter ( source , filter ) ; } else { d = parseInputSource ( 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 ) { pageContext . setAttribute ( var , d , scope ) ; } if ( varDom != null ) { pageContext . setAttribute ( varDom , d , scopeDom ) ; } return EVAL_PAGE ; }
parse source or body storing result in var