public bool MoveNext() { bool bResult = true; if (OnixDoc == null) { this.OnixDoc = new XmlDocument(); this.OnixDoc.Load(this.OnixReader); this.ProductList = this.OnixDoc.GetElementsByTagName(this.ProductXmlTag); } if (++CurrentIndex < this.ProductList.Count) { string sInputXml = this.ProductList[CurrentIndex].OuterXml; try { CurrentRecord = this.ProductSerializer.Deserialize(new StringReader(sInputXml)) as OnixLegacyProduct; if ((CurrentRecord != null) && OnixParser.AlwaysReturnInputXml) { CurrentRecord.SetInputXml(sInputXml); } if ((CurrentRecord != null) && (CurrentRecord.OnixOtherTextList != null) && (CurrentRecord.OnixOtherTextList.Length > 0)) { int nOTCount = CurrentRecord.OnixOtherTextList.Length; for (int nIdx = 0; nIdx < OtherTextList.Count; ++nIdx) { if (nIdx < nOTCount) { OnixLegacyOtherText TempText = CurrentRecord.OnixOtherTextList[nIdx]; TempText.Text = OtherTextList[nIdx]; } } } OtherTextList.Clear(); } catch (Exception ex) { CurrentRecord = new OnixLegacyProduct(); CurrentRecord.SetParsingError(ex); CurrentRecord.SetInputXml(sInputXml); } } else { bResult = false; } return(bResult); }
public bool MoveNext() { bool bResult = false; string sProductBody = null; while (this.OnixReader.Read()) { if ((this.OnixReader.NodeType == XmlNodeType.Element) && (this.OnixReader.Name == this.ProductXmlTag)) { // XElement product = XElement.ReadFrom(reader) as XElement; sProductBody = this.OnixReader.ReadOuterXml(); break; } } if (!String.IsNullOrEmpty(sProductBody)) { try { CurrentRecord = this.ProductSerializer.Deserialize(new StringReader(sProductBody)) as OnixLegacyProduct; bResult = true; } catch (Exception ex) { CurrentRecord = new OnixLegacyProduct(); CurrentRecord.SetParsingError(ex); CurrentRecord.SetInputXml(sProductBody); } } return(bResult); }