From: Oleg T. <he...@us...> - 2004-10-25 18:18:16
|
Update of /cvsroot/mvp-xml/Common/v1/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23399/v1/src Modified Files: Common.csproj Added Files: XmlBaseAwareXmlTextReader.cs Log Message: Added XmlBaseAwareXmltextReader impl and test. --- NEW FILE: XmlBaseAwareXmlTextReader.cs --- #region using using System; using System.Xml; using System.IO; #endregion namespace Mvp.Xml.Common { /// <summary> /// XmltextReader supporting XML Base. /// </summary> public class XmlBaseAwareXmlTextReader : XmlTextReader { #region private private Uri _baseUri = null; #endregion #region constructors /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given URI. /// </summary> public XmlBaseAwareXmlTextReader(string uri) : base(uri) { _baseUri = new Uri(base.BaseURI); } /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given URI and /// name table. /// </summary> public XmlBaseAwareXmlTextReader(string uri, XmlNameTable nt) : base(uri, nt) { _baseUri = new Uri(base.BaseURI); } /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given TextReader. /// </summary> public XmlBaseAwareXmlTextReader(TextReader reader) : base(reader) {} /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given uri and /// TextReader. /// </summary> public XmlBaseAwareXmlTextReader(string uri, TextReader reader) : base(uri, reader) { _baseUri = new Uri(base.BaseURI); } /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given TextReader /// and name table. /// </summary> public XmlBaseAwareXmlTextReader(TextReader reader, XmlNameTable nt) : base(reader, nt) {} /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given uri, name table /// and TextReader. /// </summary> public XmlBaseAwareXmlTextReader(string uri, TextReader reader, XmlNameTable nt) : base(uri, reader, nt) { _baseUri = new Uri(base.BaseURI); } /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given stream. /// </summary> public XmlBaseAwareXmlTextReader(Stream stream) : base(stream) {} /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given uri and stream. /// </summary> public XmlBaseAwareXmlTextReader(string uri, Stream stream) : base(uri, stream) { _baseUri = new Uri(base.BaseURI); } /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given stream /// and name table. /// </summary> public XmlBaseAwareXmlTextReader(Stream stream, XmlNameTable nt) : base(stream, nt) {} /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given stream, /// uri and name table. /// </summary> public XmlBaseAwareXmlTextReader(string uri, Stream stream, XmlNameTable nt) : base(uri, stream, nt) { _baseUri = new Uri(base.BaseURI); } #endregion #region XmlTextReader overrides /// <summary> /// See <see cref="XmlTextReader.BaseURI"/>. /// </summary> public override string BaseURI { get { return _baseUri==null? "" : _baseUri.AbsoluteUri; } } /// <summary> /// See <see cref="XmlTextReader.Read"/>. /// </summary> public override bool Read() { bool baseRead = base.Read(); if (baseRead && base.NodeType == XmlNodeType.Element && base.HasAttributes) { string baseAttr = GetAttribute("xml:base"); if (baseAttr == null) return baseRead; if (_baseUri == null) _baseUri = new Uri(baseAttr); else _baseUri = new Uri(_baseUri, baseAttr); } return baseRead; } #endregion } } Index: Common.csproj =================================================================== RCS file: /cvsroot/mvp-xml/Common/v1/src/Common.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Common.csproj 27 Sep 2004 16:27:12 -0000 1.1 +++ Common.csproj 25 Oct 2004 18:18:05 -0000 1.2 @@ -103,6 +103,11 @@ BuildAction = "EmbeddedResource" /> <File + RelPath = "XmlBaseAwareXmlTextReader.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "XmlFirstLowerWriter.cs" SubType = "Code" BuildAction = "Compile" |