Source getSourceFromXmlAttribute ( ) throws JspTagException , SAXException , ParserConfigurationException { Object xml = this . xml ; if ( xml == null ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_XML_IS_NULL" ) ) ; } // other JSTL XML tags may produce a list if ( xml instanceof List ) { List < ? > list = ( List < ? > ) xml ; if ( list . size ( ) != 1 ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_XML_LIST_SIZE" ) ) ; } xml = list . get ( 0 ) ; } if ( xml instanceof Source ) { return ( Source ) xml ; } if ( xml instanceof String ) { String s = ( String ) xml ; s = s . trim ( ) ; if ( s . length ( ) == 0 ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_XML_IS_EMPTY" ) ) ; } return XmlUtil . newSAXSource ( new StringReader ( s ) , xmlSystemId , entityResolver ) ; } if ( xml instanceof Reader ) { return XmlUtil . newSAXSource ( ( Reader ) xml , xmlSystemId , entityResolver ) ; } if ( xml instanceof Node ) { return new DOMSource ( ( Node ) xml , xmlSystemId ) ; } throw new JspTagException ( Resources . getMessage ( "TRANSFORM_XML_UNSUPPORTED_TYPE" , xml . getClass ( ) ) ) ; }
Return the Source for a document specified in the doc or xml attribute .