Changeset 4540

Show
Ignore:
Timestamp:
01/13/08 16:11:30 (11 months ago)
Author:
xmlhacker
Message:

updated to be a bit more clean

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/nuxleus/Source/Xameleon/Function/HttpWebRequest.cs

    r4539 r4540  
    44using System.Text; 
    55 
    6 namespace Xameleon.Function 
    7 
    8     class HttpWebRequestStream 
    9     { 
     6namespace Xameleon.Function { 
     7    class HttpWebRequestStream { 
    108 
    11         public HttpWebRequestStream() { } 
     9        public HttpWebRequestStream () { } 
    1210 
    13         //public static string GetResponse (String uri, bool returnUri) { 
    14         //    WebRequest myHttpWebRequest = WebRequest.Create(uri); 
    15         //    myHttpWebRequest.Method = "GET"; 
    16         //    if (!returnUri) { 
    17         //        return HttpWebResponseStream.GetResponseString(myHttpWebRequest.GetResponse().GetResponseStream()); 
    18         //    } else { 
    19         //        return myHttpWebRequest.GetResponse().ResponseUri.ToString(); 
    20         //    } 
    21         //} 
    22  
    23         public static string GetResponse(String uri) 
    24         { 
     11        public static string GetResponse (String uri) { 
    2512            return new WebClient().DownloadString(uri); 
    2613        } 
    2714 
    28         public static string GetResponse(String uri, String formValues) 
    29         { 
     15        public static string GetResponse (String uri, String formValues) { 
    3016            WebRequest myHttpWebRequest = WebRequest.Create(uri); 
    3117 
     
    3925            myHttpWebRequest.ContentLength = byte1.Length; 
    4026 
    41             Stream newStream = myHttpWebRequest.GetRequestStream(); 
    42             newStream.Write(byte1, 0, byte1.Length); 
    43             newStream.Close(); 
    44             return HttpWebResponseStream.GetResponseString(myHttpWebRequest.GetResponse().GetResponseStream()); 
     27            using (Stream newStream = myHttpWebRequest.GetRequestStream()) { 
     28                newStream.Write(byte1, 0, byte1.Length); 
     29            } 
     30            return GetResponseString(myHttpWebRequest.GetResponse().GetResponseStream()); 
    4531        } 
     32 
     33        public static string GetResponseString (Stream stream) { 
     34            using (StreamReader reader = new StreamReader(stream)) { 
     35                return reader.ReadToEnd(); 
     36            } 
     37        } 
     38 
     39        //public static string GetResponse (String uri, bool returnUri) { 
     40        //    WebRequest myHttpWebRequest = WebRequest.Create(uri); 
     41        //    myHttpWebRequest.Method = "GET"; 
     42        //    if (!returnUri) { 
     43        //        return GetResponseString(myHttpWebRequest.GetResponse().GetResponseStream()); 
     44        //    } else { 
     45        //        return myHttpWebRequest.GetResponse().ResponseUri.ToString(); 
     46        //    } 
     47        //} 
    4648    } 
    4749} 
  • trunk/nuxleus/Source/Xameleon/Transform/XsltTransformationManager.cs

    r4538 r4540  
    4949        public XsltTransformationManager (Processor processor, Transform transform, XmlUrlResolver resolver, Serializer serializer) 
    5050            : this(processor, transform, resolver, serializer, new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), null, null, null) { 
    51         } 
    52         public XsltTransformationManager (Processor processor, Transform transform, XmlUrlResolver resolver, Serializer serializer, Hashtable xsltHashtable) 
    53             : this(processor, transform, resolver, serializer, xsltHashtable, new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), null, null, null) { 
    54         } 
    55         public XsltTransformationManager (Processor processor, Transform transform, XmlUrlResolver resolver, Serializer serializer, Hashtable xsltHashtable, Hashtable namedXsltHashtable) 
    56             : this(processor, transform, resolver, serializer, xsltHashtable, new Hashtable(), new Hashtable(), namedXsltHashtable, new Hashtable(), new Hashtable(), null, null, null) { 
    57         } 
    58         public XsltTransformationManager (Processor processor, Transform transform, XmlUrlResolver resolver, Serializer serializer, Hashtable xsltHashtable, Hashtable xmlSourceHashtable, Hashtable namedXsltHashtable) 
    59             : this(processor, transform, resolver, serializer, xsltHashtable, xmlSourceHashtable, new Hashtable(), namedXsltHashtable, new Hashtable(), new Hashtable(), null, null, null) { 
    60         } 
    61         public XsltTransformationManager (Processor processor, Transform transform, XmlUrlResolver resolver, Serializer serializer, Hashtable xsltHashtable, Hashtable xmlSourceHashtable, Hashtable xdmNodeHashtable, Hashtable namedXsltHashtable) 
    62             : this(processor, transform, resolver, serializer, xsltHashtable, xmlSourceHashtable, xdmNodeHashtable, namedXsltHashtable, new Hashtable(), new Hashtable(), null, null, null) { 
    63         } 
    64         public XsltTransformationManager (Processor processor, Transform transform, XmlUrlResolver resolver, Serializer serializer, Hashtable xsltHashtable, Hashtable xmlSourceHashtable, Hashtable xdmNodeHashtable, Hashtable namedXsltHashtable, Hashtable namedXsltETagIndex) 
    65             : this(processor, transform, resolver, serializer, xsltHashtable, xmlSourceHashtable, xdmNodeHashtable, namedXsltHashtable, namedXsltETagIndex, new Hashtable(), null, null, null) { 
    66         } 
    67         public XsltTransformationManager (Processor processor, Transform transform, XmlUrlResolver resolver, Serializer serializer, Hashtable xsltHashtable, Hashtable xmlSourceHashtable, Hashtable xdmNodeHashtable, Hashtable namedXsltHashtable, Hashtable namedXsltETagIndex, Hashtable xdmNodeETagIndex) 
    68             : this(processor, transform, resolver, serializer, xsltHashtable, xmlSourceHashtable, xdmNodeHashtable, namedXsltHashtable, namedXsltETagIndex, xdmNodeETagIndex, null, null, null) { 
    6951        } 
    7052        public XsltTransformationManager 
     
    10082            m_namedXsltHashtable = namedXsltHashtable; 
    10183            m_namedXsltETagIndex = namedXsltETagIndex; 
    102             _hashAlgorithm = HashAlgorithm.SHA1
     84            _hashAlgorithm = HashAlgorithm.MD5
    10385            //NOTE: TransformEngine enum PLACEHOLDER FOR FUTURE USE 
    10486            m_transformEngine = TransformEngine.SAXON; 
     
    153135        } 
    154136        private void addTransformer (string key, string name, Uri uri, XmlUrlResolver resolver, string initialMode, string initialTemplate, string baseOutputUri) { 
     137            m_compiler.BaseUri = uri; 
    155138            XsltTransformer transformer = createNewTransformer(uri); 
    156139            transformer.InputXmlResolver = resolver;