Пример #1
0
        public bool ParseXml(string xmlContent, object context)
        {
            try
            {
#if JAVASCRIPT
                XmlDocumentParser parser   = new XmlDocumentParser();
                XmlDocument       document = parser.ParseFromString(xmlContent, "text/xml");
#else
                XmlDocument document = new XmlDocument();
                document.LoadXml(xmlContent);
#endif
                foreach (XmlNode root in document.ChildNodes)
                {
                    if (StringEquals(root.Name, "root"))
                    {
                        foreach (XmlNode node in root.ChildNodes)
                        {
                            ProcessXmlNode(node, context);
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Exception loading xml content: " + ex);
                return(false);
            }
        }
Пример #2
0
        private void LoadCabinet()
        {
            if (webFile.State == StateType.Error)
            {
                Script.Literal("alert({0})", webFile.Message);
            }
            else if (webFile.State == StateType.Received)
            {
                mainBlob = (System.Html.Data.Files.Blob)webFile.GetBlob();
                FileReader chunck = new FileReader();
                chunck.OnLoadEnd = delegate(System.Html.Data.Files.FileProgressEvent e)
                {
                    int offset = GetSize((string)chunck.Result);

                    FileReader header = new FileReader();
                    header.OnLoadEnd = delegate(System.Html.Data.Files.FileProgressEvent ee)
                    {
                        string            data    = header.Result as string;
                        XmlDocumentParser xParser = new XmlDocumentParser();
                        Extract(xParser.ParseFromString(data, "text/xml"), offset);
                        callMe();
                    };
                    header.ReadAsText(mainBlob.Slice(0, offset));
                };
                chunck.ReadAsText(mainBlob.Slice(0, 255));
            }
        }
Пример #3
0
        public static VoTable LoadFromString(string data)
        {
            XmlDocumentParser xParser = new XmlDocumentParser();
            XmlDocument       doc     = xParser.ParseFromString(data, "text/xml");

            VoTable table = new VoTable();

            table.LoadFromXML(doc);

            return(table);
        }
Пример #4
0
        public App()
        {
            MyElement elem = (MyElement)Document.GetElementById("foo");
            string    s    = elem.myString;

            elem["Smith"] = elem["Joe"];

            int n = Math.Truncate(5.5);
            XmlDocumentParser parser = new XmlDocumentParser();
            XmlDocument       doc    = parser.ParseFromString("<markup></markup>", "text/xml");
            Date d = Date.Parse("1/1/2010");
        }
Пример #5
0
        private void LoadXmlDocument()
        {
            string master = cabinet.MasterFile;

            FileReader doc = new FileReader();

            doc.OnLoadEnd = delegate(FileProgressEvent ee)
            {
                string            data    = doc.Result as string;
                XmlDocumentParser xParser = new XmlDocumentParser();
                FromXml(xParser.ParseFromString(data, "text/xml"));
                callMe();
            };
            doc.ReadAsText(cabinet.GetFileBlob(master));
        }
Пример #6
0
        public App()
        {
            MyElement elem = (MyElement)Document.GetElementById("foo");
            string    s    = elem.myString;

            elem.DoFoo();
            elem.DoBar(10);

            elem["Smith"] = elem["Joe"];

            int n = Math.Truncate(5.5);
            XmlDocumentParser parser = new XmlDocumentParser();
            XmlDocument       doc    = parser.ParseFromString("<markup></markup>", "text/xml");
            Date d = Date.Parse("1/1/2010");

            Action eventHandler = delegate() { };

            elem.Click += eventHandler;
            elem.Click -= eventHandler;
        }
Пример #7
0
        private void LoadXmlDocument()
        {
            try
            {
                string master = cabinet.MasterFile;

                FileReader doc = new FileReader();
                doc.OnLoadEnd = delegate(FileProgressEvent ee)
                {
                    string            data    = doc.Result as string;
                    XmlDocumentParser xParser = new XmlDocumentParser();
                    FromXml(xParser.ParseFromString(data, "text/xml"));
                    callMe();
                };
                doc.ReadAsText(cabinet.GetFileBlob(master));
            }
            catch (Exception ex)
            {
                WWTControl.scriptInterface.FireTourError(ex);
            }
        }
        public XmlDocument GetXml()
        {
            XmlDocumentParser xParser = new XmlDocumentParser();

            return(xParser.ParseFromString(_data, "text/xml"));
        }