Пример #1
0
        private void Reinit()
        {
            var fontData = new RawDataContainer();

            System.GetSingleton().GetResourceProvider()
            .LoadRawDataContainer(d_filename, fontData, String.IsNullOrEmpty(d_resourceGroup)
                                                                  ? GetDefaultResourceGroup()
                                                                  : d_resourceGroup);
            LoadFntFile(fontData.Stream());
        }
Пример #2
0
        public override void ParseXml(XmlHandler handler, RawDataContainer source, string schemaName, bool allowXmlValidation = true)
        {
            var settings = new XmlReaderSettings {
                IgnoreWhitespace = true
            };

            if (!String.IsNullOrEmpty(schemaName))
            {
                using (var schemaFile = new RawDataContainer())
                {
                    System.GetSingleton().GetResourceProvider().LoadRawDataContainer(schemaName, schemaFile, "schemas");
                    settings.Schemas.Add(null, new XmlTextReader(schemaFile.Stream()));
                }
            }

            using (var reader = XmlReader.Create(source.Stream(), settings))
            {
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case XmlNodeType.Element:
                        OnStartElement(reader, handler);
                        reader.MoveToElement();
                        if (reader.IsEmptyElement)
                        {
                            OnEndElement(reader, handler);
                        }
                        break;

                    case XmlNodeType.EndElement:
                        OnEndElement(reader, handler);
                        break;

                    case XmlNodeType.Text:
                    case XmlNodeType.CDATA:
                        OnText(reader, handler);
                        break;
                    }
                }
            }
        }