InferDeduceSchema
        (
            string data
        )
        {
            global::System.Xml.Schema.XmlSchema schema = null;

            //Begin parsing source XML document

            global::System.Xml.XmlDocument doc = new global::System.Xml.XmlDocument();

            try
            {
                //Assume string XML
                doc.LoadXml(data);
            }
            catch
            {
                //String XML load failed.   Try loading as a file path
                try
                {
                    doc.Load(data);
                }
                catch
                {
                    throw new global::System.Xml.Schema.XmlSchemaException("XML document is not well-formed.");
                }
            }

            global::System.Xml.XmlElement root = doc.DocumentElement;

            global::System.Xml.XmlReader reader = null;
            reader = global::System.Xml.XmlReader.Create(new System.IO.StringReader(data));
            global::System.Xml.Schema.XmlSchemaSet schema_set = null;
            schema_set = new global::System.Xml.Schema.XmlSchemaSet();
            global::System.Xml.Schema.XmlSchemaInference schema_inferred = null;
            schema_inferred = new global::System.Xml.Schema.XmlSchemaInference();
            schema_set      = schema_inferred.InferSchema(reader);

            foreach (global::System.Xml.Schema.XmlSchema s in schema_set.Schemas())
            {
                using (global::System.IO.StringWriter sw = new global::System.IO.StringWriter())
                {
                    using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(sw))
                    {
                        s.Write(writer);
                    }
                }
            }

            return
                //(
                (schema
                 //    types: types
                 //)
                );
        }
 internal static object CreatePrivate(global::System.Xml.XmlDocument document)
 {
     object[] args = new object[] {
         document
     };
     Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject priv_obj = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject("WXML.Model", "WXML.Model.WXMLModelReader", new System.Type[] {
         typeof(global::System.Xml.XmlDocument)
     }, args);
     return(priv_obj.Target);
 }
 internal static global::WXML.Model.WXMLModel LoadXmlDocument(global::System.Xml.XmlDocument document, bool skipValidation)
 {
     object[] args = new object[] {
         document,
         skipValidation
     };
     global::WXML.Model.WXMLModel ret = ((global::WXML.Model.WXMLModel)(m_privateType.InvokeStatic("LoadXmlDocument", new System.Type[] {
         typeof(global::System.Xml.XmlDocument),
         typeof(bool)
     }, args)));
     return(ret);
 }
Example #4
0
 internal void TrySaveToDisk(global::System.Xml.XmlDocument doc, string url, global::System.DateTime utcExpiry)
 {
     object[] args = new object[] {
         doc,
         url,
         utcExpiry
     };
     m_privateObject.Invoke("TrySaveToDisk", new System.Type[] {
         typeof(global::System.Xml.XmlDocument),
         typeof(string),
         typeof(global::System.DateTime)
     }, args);
 }
Example #5
0
        // Private Methods (1) 


        private static void AsStringExtension(object obj, ref bool handled, ref global::System.Text.StringBuilder result)
        {
#if !WINDOWS_PHONE
            if (obj is global::System.Xml.XmlReader)
            {
                global::System.Xml.XmlReader xmlReader = (global::System.Xml.XmlReader)obj;

                global::System.Xml.XmlDocument xmlDoc = new global::System.Xml.XmlDocument();
                xmlDoc.Load(xmlReader);

                result.Append(AsString(xmlDoc, true));
                handled = true;
            }
            else if (obj is global::System.Xml.XmlNode)
            {
                // old skool XML

                result.Append(((global::System.Xml.XmlNode)obj).OuterXml);
                handled = true;
            }
#endif
        }