/// <summary> /// See <see cref="XmlTextReader.Read"/>. /// </summary> public override bool Read() { bool baseRead = base.Read(); if (baseRead) { if (base.NodeType == XmlNodeType.Element && base.HasAttributes) { string baseAttr = GetAttribute("xml:base"); if (baseAttr == null) { return(baseRead); } Uri newBaseUri = null; if (_state.BaseUri == null) { newBaseUri = new Uri(baseAttr); } else { newBaseUri = new Uri(_state.BaseUri, baseAttr); } if (_states == null) { _states = new Stack(); } //Push current state and allocate new one _states.Push(_state); _state = new XmlBaseState(newBaseUri, base.Depth); } else if (base.NodeType == XmlNodeType.EndElement) { if (base.Depth == _state.Depth && _states != null && _states.Count > 0) { //Pop previous state _state = (XmlBaseState)_states.Pop(); } } } return(baseRead); }
/// <summary> /// See <see cref="XmlTextReader.Read"/>. /// </summary> public override bool Read() { bool baseRead = base.Read(); if (baseRead) { if (NodeType == XmlNodeType.Element && HasAttributes) { string baseAttr = GetAttribute("xml:base"); if (baseAttr == null) { return(true); } Uri newBaseUri = state.BaseUri == null ? new Uri(baseAttr) : new Uri(state.BaseUri, baseAttr); if (states == null) { states = new Stack <XmlBaseState>(); } //Push current state and allocate new one states.Push(state); state = new XmlBaseState(newBaseUri, Depth); } else if (NodeType == XmlNodeType.EndElement) { if (Depth == state.Depth && states != null && states.Count > 0) { //Pop previous state state = states.Pop(); } } } return(baseRead); }
/// <summary> /// See <see cref="XmlTextReader.Read"/>. /// </summary> public override bool Read() { bool baseRead = base.Read(); if (baseRead) { if (base.NodeType == XmlNodeType.Element && base.HasAttributes) { string baseAttr = GetAttribute("xml:base"); if (baseAttr == null) return baseRead; Uri newBaseUri = null; if (_state.BaseUri == null) newBaseUri = new Uri(baseAttr); else newBaseUri = new Uri(_state.BaseUri, baseAttr); if (_states == null) _states = new Stack<XmlBaseState>(); //Push current state and allocate new one _states.Push(_state); _state = new XmlBaseState(newBaseUri, base.Depth); } else if (base.NodeType == XmlNodeType.EndElement) { if (base.Depth == _state.Depth && _states != null && _states.Count > 0) { //Pop previous state _state = _states.Pop(); } } } return baseRead; }