001    /**
002     * Implements the CFML Function xmlparse
003     */
004    package railo.runtime.functions.xml;
005    
006    import org.w3c.dom.Node;
007    import org.xml.sax.InputSource;
008    
009    import railo.runtime.PageContext;
010    import railo.runtime.exp.PageException;
011    import railo.runtime.ext.function.Function;
012    import railo.runtime.op.Caster;
013    import railo.runtime.text.xml.XMLCaster;
014    import railo.runtime.text.xml.XMLUtil;
015    
016    public final class HtmlParse implements Function {
017        public static Node call(PageContext pc , String string) throws PageException {
018            return call(pc,string,false);
019        }
020        public static Node call(PageContext pc , String strHTML, boolean caseSensitive) throws PageException {
021                    try {
022                    InputSource xml = XMLUtil.toInputSource(pc,strHTML,false);
023                            return XMLCaster.toXMLStruct(XMLUtil.parse(xml,null,true),caseSensitive);
024                    } 
025                    catch (Exception e) {
026                            throw Caster.toPageException(e);
027                    }
028            
029            
030            /*try {
031                return XMLCaster.toXMLStruct(XMLUtil.parse(string,true),caseSensitive);//new XMLNodeStruct(XMLUtil.parse(string),caseSensitive);
032            } 
033            catch (Exception e) {
034                throw Caster.toPageException(e);
035            }*/
036        }
037    }