Esempio n. 1
0
        /// <summary> This method wraps <code>scan()</code> using the policy File object passed in.</summary>
        public virtual CleanResults scan(string taintedHTML, Policy policy)
        {

            AntiSamyDOMScanner antiSamy = new AntiSamyDOMScanner(policy);

            /*
            * Go get 'em!
            */

            return antiSamy.scan(taintedHTML, inputEncoding, outputEncoding);
        }
Esempio n. 2
0
 /// <summary> This retrieves a Policy based on the File object passed in</summary>
 /// <param name="file">A File object which contains the XML policy information.
 /// </param>
 /// <returns> A populated Policy object based on the XML policy file pointed to by the File parameter.
 /// </returns>
 /// <throws>  PolicyException If the file is not found or there is a problem parsing the file. </throws>
 public static Policy getInstance(FileInfo file)
 {
     _instance = new Policy(new FileInfo(file.FullName));
     return _instance;
 }
Esempio n. 3
0
 /// <summary> This retrieves a Policy based on a default location ("resources/antisamy.xml")</summary>
 /// <returns> A populated Policy object based on the XML policy file located in the default location.
 /// </returns>
 /// <throws>  PolicyException If the file is not found or there is a problem parsing the file. </throws>
 public static Policy getInstance()
 {
     _instance = new Policy(DEFAULT_POLICY_URI);
     return _instance;
 }
Esempio n. 4
0
 /// <summary> This retrieves a Policy based on the file name passed in</summary>
 /// <param name="filename">The path to the XML policy file.
 /// </param>
 /// <returns> A populated Policy object based on the XML policy file located in the location passed in.
 /// </returns>
 /// <throws>  PolicyException If the file is not found or there is a problem parsing the file. </throws>
 public static Policy getInstance(string filename)
 {
     _instance = new Policy(filename);
     return _instance;
 }
Esempio n. 5
0
 public void SetUp()
 {
     policy = Policy.getInstance(filename);
 }