Пример #1
0
        public OnixLegacyEnumerator(OnixLegacyParser ProvidedParser, StringBuilder LegacyOnixContent)
        {
            this.ProductXmlTag = ProvidedParser.ReferenceVersion ? "Product" : "product";

            this.OnixParser = ProvidedParser;

            // this.OnixReader = OnixLegacyParser.CreateXmlReader(LegacyOnixContent, false, ProvidedParser.PerformValidation);
            this.OnixReader = OnixLegacyParser.CreateXmlTextReader(LegacyOnixContent);

            ProductSerializer = new XmlSerializer(typeof(OnixLegacyProduct), new XmlRootAttribute(this.ProductXmlTag));
        }
Пример #2
0
        public OnixLegacyEnumerator(OnixLegacyParser ProvidedParser, FileInfo LegacyOnixFilepath)
        {
            this.ProductXmlTag = ProvidedParser.ReferenceVersion ? "Product" : "product";

            this.OnixParser = ProvidedParser;

            // this.OnixReader = OnixLegacyParser.CreateXmlReader(LegacyOnixFilepath, false, ProvidedParser.PerformValidation);
            this.OnixReader = OnixLegacyParser.CreateXmlTextReader(LegacyOnixFilepath);

            ProductSerializer = new XmlSerializer(typeof(OnixLegacyProduct), new XmlRootAttribute(this.ProductXmlTag));

            ProductSerializer.UnknownElement += (s, e) =>
            {
                if (((e.Element.LocalName == "Text") || (e.Element.LocalName == "d104")) &&
                    e.ObjectBeingDeserialized is OnixLegacyOtherText)
                {
                    OtherTextList.Add(e.Element.InnerText);
                }
            };
        }