From: Oleg T. <he...@us...> - 2005-10-16 16:51:38
|
Update of /cvsroot/mvp-xml/Common/v2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3371/v2/src Added Files: .cvsignore AssemblyInfo.cs Common.csproj SR.cs SR.resx XmlBaseAwareXmlTextReader.cs XmlFirstLowerWriter.cs XmlFirstUpperReader.cs XmlNamespaces.cs XmlNodeListFactory.cs XmlPrefix.cs changelog.txt Log Message: --- NEW FILE: XmlNodeListFactory.cs --- #region using using System; using System.Collections; using System.Xml; using System.Xml.XPath; #endregion using namespace Mvp.Xml.Common { /// <summary> /// Constructs <see cref="XmlNodeList"/> instances from /// <see cref="XPathNodeIterator"/> objects. /// </summary> /// <remarks>See http://weblogs.asp.net/cazzu/archive/2004/04/14/113479.aspx. /// <para>Author: Daniel Cazzulino, kz...@gm...</para> /// </remarks> public sealed class XmlNodeListFactory { private XmlNodeListFactory() { } #region Public members /// <summary> /// Creates an instance of a <see cref="XmlNodeList"/> that allows /// enumerating <see cref="XmlNode"/> elements in the iterator. /// </summary> /// <param name="iterator">The result of a previous node selection /// through an <see cref="XPathNavigator"/> query.</param> /// <returns>An initialized list ready to be enumerated.</returns> /// <remarks>The underlying XML store used to issue the query must be /// an object inheriting <see cref="XmlNode"/>, such as /// <see cref="XmlDocument"/>.</remarks> public static XmlNodeList CreateNodeList(XPathNodeIterator iterator) { return new XmlNodeListIterator(iterator); } #endregion Public members #region XmlNodeListIterator private class XmlNodeListIterator : XmlNodeList { XPathNodeIterator _iterator; ArrayList _nodes = new ArrayList(); public XmlNodeListIterator(XPathNodeIterator iterator) { _iterator = iterator.Clone(); } public override IEnumerator GetEnumerator() { return new XmlNodeListEnumerator(this); } public override XmlNode Item(int index) { if (index >= _nodes.Count) ReadTo(index); // Compatible behavior with .NET if (index >= _nodes.Count || index < 0) return null; return (XmlNode)_nodes[index]; } public override int Count { get { if (!_done) ReadToEnd(); return _nodes.Count; } } /// <summary> /// Reads the entire iterator. /// </summary> private void ReadToEnd() { while (_iterator.MoveNext()) { IHasXmlNode node = _iterator.Current as IHasXmlNode; // Check IHasXmlNode interface. if (node == null) throw new ArgumentException(SR.XmlNodeListFactory_IHasXmlNodeMissing); _nodes.Add(node.GetNode()); } _done = true; } /// <summary> /// Reads up to the specified index, or until the /// iterator is consumed. /// </summary> private void ReadTo(int to) { while (_nodes.Count <= to) { if (_iterator.MoveNext()) { IHasXmlNode node = _iterator.Current as IHasXmlNode; // Check IHasXmlNode interface. if (node == null) throw new ArgumentException(SR.XmlNodeListFactory_IHasXmlNodeMissing); _nodes.Add(node.GetNode()); } else { _done = true; return; } } } /// <summary> /// Flags that the iterator has been consumed. /// </summary> private bool Done { get { return _done; } } bool _done; /// <summary> /// Current count of nodes in the iterator (read so far). /// </summary> private int CurrentPosition { get { return _nodes.Count; } } #region XmlNodeListEnumerator private class XmlNodeListEnumerator : IEnumerator { XmlNodeListIterator _iterator; int _position = -1; public XmlNodeListEnumerator(XmlNodeListIterator iterator) { _iterator = iterator; } #region IEnumerator Members void System.Collections.IEnumerator.Reset() { _position = -1; } bool System.Collections.IEnumerator.MoveNext() { _position++; _iterator.ReadTo(_position); // If we reached the end and our index is still // bigger, there're no more items. if (_iterator.Done && _position >= _iterator.CurrentPosition) return false; return true; } object System.Collections.IEnumerator.Current { get { return _iterator[_position]; } } #endregion } #endregion XmlNodeListEnumerator } #endregion XmlNodeListIterator } } --- NEW FILE: .cvsignore --- bin obj *.user *.suo --- NEW FILE: changelog.txt --- May 28, 2005 Added ObjectNode to XmlNodeFactory to improve performance of client-side message-based communication with web services through XmlSerializer. See: http://weblogs.asp.net/cazzu/posts/xmlmessageperformance.aspx --------------------------------------------------------- January 04, 2005 Added Serialization folder and classes. --------------------------------------------------------- November 13, 2004 Bug fix in XmlNodeListFactory. Thanks to Raneses, Jason. Bug fixes in XPathNavigatorReader (thanks Oleg!) --------------------------------------------------------- October 8, 2004 Bug fix in XPathCache that caused NullReferenceExceptions if an XmlNamespaceManager is not used when selecting nodes. --------------------------------------------------------- June 30, 2004 Added XPathNavigatorIterator Allows building an iterator by hand, by appending navigators. XPathNavigatorReader.InnerXml fixed. Thanks to Lawrence Oluyede! --------------------------------------------------------- June 24, 2004 Added SubtreeXPathNavigator See: http://weblogs.asp.net/cazzu/archive/2004/06/24/164243.aspx. --------------------------------------------------------- May 31, 2004 Added XmlNodeFactory See: http://weblogs.asp.net/cazzu/archive/2004/05/31/144922.aspx. --------------------------------------------------------- May 27, 2004 Added sort overloads to XPathCache. Thanks to Jason Addie. --------------------------------------------------------- May 15, 2004 Bug fixing in XPathNavigatorReader Thanks to Joost Ploegmakers --------------------------------------------------------- May 10, 2004 Bug fixing in XPathNavigatorReader See: http://weblogs.asp.net/cazzu/archive/2004/05/10/129101.aspx Added XmlFirstUpperReader and XmlFirstLowerWriter See: http://weblogs.asp.net/cazzu/archive/2004/05/10/129106.aspx --------------------------------------------------------- April 26, 2004 Added XPathIteratorReader See: http://weblogs.asp.net/cazzu/archive/2004/04/26/120684.aspx --------------------------------------------------------- April 23, 2004 Added XmlFragmentStream: See: http://weblogs.asp.net/cazzu/archive/2004/04/23/119263.aspx --------------------------------------------------------- April 19, 2004 Fully working production-quality XPathNavigatorReader. See: http://weblogs.asp.net/cazzu/archive/2004/04/19/115966.aspx --------------------------------------------------------- April 11, 2004 Added IndexingXPathNavigator code. See http://www.tkachenko.com/blog/archives/000194.html --------------------------------------------------------- April 02, 2004 XPathCache and DynamicContext added to project. See: http://weblogs.asp.net/cazzu/archive/2004/04/02/106667.aspx --------------------------------------------------------- April 01, 2004 Initial setup. Folder contains main project source files. --- NEW FILE: XmlFirstLowerWriter.cs --- #region using using System; using System.IO; using System.Text; using System.Xml; #endregion using namespace Mvp.Xml.Common { /// <summary> /// Implements an <see cref="XmlWriter"/> that turns the /// first letter of outgoing elements and attributes into lowercase. /// </summary> /// <remarks> /// To be used in conjunction with <see cref="XmlFirstUpperReader"/>. /// <para>Author: Daniel Cazzulino, kz...@gm...</para> /// See http://weblogs.asp.net/cazzu/archive/2004/05/10/129106.aspx. /// </remarks> public class XmlFirstLowerWriter : XmlTextWriter { #region Fields & Ctor /// <summary> /// See <see cref="XmlTextWriter"/> ctors. /// </summary> public XmlFirstLowerWriter(TextWriter w) : base(w) { } /// <summary> /// See <see cref="XmlTextWriter"/> ctors. /// </summary> public XmlFirstLowerWriter(Stream w, Encoding encoding) : base(w, encoding) { } /// <summary> /// See <see cref="XmlTextWriter"/> ctors. /// </summary> public XmlFirstLowerWriter(string filename, Encoding encoding) : base(filename, encoding) { } #endregion Fields & Ctor #region MakeFirstLower internal static string MakeFirstLower(string name) { // Don't process empty strings. if (name.Length == 0) return name; // If the first is already lower, don't process. if (Char.IsLower(name[0])) return name; // If there's just one char, make it lower directly. if (name.Length == 1) return name.ToLower(System.Globalization.CultureInfo.CurrentCulture); // Finally, modify and create a string. Char[] letters = name.ToCharArray(); letters[0] = Char.ToLower(letters[0], System.Globalization.CultureInfo.CurrentCulture); return new string(letters); } #endregion MakeFirstUpper #region Methods /// <summary> /// See <see cref="XmlWriter.WriteQualifiedName"/>. /// </summary> public override void WriteQualifiedName(string localName, string ns) { base.WriteQualifiedName(MakeFirstLower(localName), ns); } /// <summary> /// See <see cref="XmlWriter.WriteStartAttribute(string, string, string)"/>. /// </summary> public override void WriteStartAttribute(string prefix, string localName, string ns) { base.WriteStartAttribute(prefix, MakeFirstLower(localName), ns); } /// <summary> /// See <see cref="XmlWriter.WriteStartElement(string, string, string)"/>. /// </summary> public override void WriteStartElement(string prefix, string localName, string ns) { base.WriteStartElement(prefix, MakeFirstLower(localName), ns); } #endregion Methods } } --- NEW FILE: Common.csproj --- (This appears to be a binary file; contents omitted.) --- NEW FILE: XmlFirstUpperReader.cs --- #region using using System; using System.IO; using System.Xml; #endregion using namespace Mvp.Xml.Common { /// <summary> /// Implements an <see cref="XmlTextReader"/> that turns the /// first letter of incoming elements and attributes into uppercase. /// </summary> /// <remarks> /// To be used in conjunction with <see cref="XmlFirstLowerWriter"/> for /// serialization. /// <para>Author: Daniel Cazzulino, kz...@gm...</para> /// See http://weblogs.asp.net/cazzu/archive/2004/05/10/129106.aspx. /// </remarks> public class XmlFirstUpperReader : XmlTextReader { #region Ctors /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(Stream input) : base(input) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(TextReader input) : base(input) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(string url) : base(url) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(Stream input, XmlNameTable nt) : base(input, nt) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(TextReader input, XmlNameTable nt) : base(input, nt) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(string url, Stream input) : base(url, input) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(string url, TextReader input) : base(url, input) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(string url, XmlNameTable nt) : base(url, nt) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(Stream xmlFragment, XmlNodeType fragType, XmlParserContext context) : base(xmlFragment, fragType, context) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(string url, Stream input, XmlNameTable nt) : base(url, input, nt) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(string url, TextReader input, XmlNameTable nt) : base(url, input, nt) {} /// <summary> /// See <see cref="XmlTextReader"/> constructor overloads. /// </summary> public XmlFirstUpperReader(string xmlFragment, XmlNodeType fragType, XmlParserContext context) : base(xmlFragment, fragType, context) {} #endregion Ctors #region Private methods private string MakeFirstUpper(string name) { // Don't process empty strings. if (name.Length == 0) return name; // If the first is already upper, don't process. if (Char.IsUpper(name[0])) return name; // If there's just one char, make it lower directly. if (name.Length == 1) return name.ToUpper(System.Globalization.CultureInfo.CurrentCulture); // Finally, modify and create a string. Char[] letters = name.ToCharArray(); letters[0] = Char.ToUpper(letters[0], System.Globalization.CultureInfo.CurrentUICulture); return NameTable.Add(new string(letters)); } #endregion Private methods #region Properties /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> public override string this[string name, string namespaceURI] { get { return base[ NameTable.Add(XmlFirstLowerWriter.MakeFirstLower(name)), namespaceURI]; } } /// <summary>See <see cref="XmlReader.this[string]"/></summary> public override string this[string name] { get { return this[name, String.Empty]; } } /// <summary>See <see cref="XmlReader.LocalName"/></summary> public override string LocalName { get { // Capitalize elements and attributes. if ( base.NodeType == XmlNodeType.Element || base.NodeType == XmlNodeType.EndElement || base.NodeType == XmlNodeType.Attribute ) { return base.NamespaceURI == XmlNamespaces.XmlNs ? // Except if the attribute is a namespace declaration base.LocalName : MakeFirstUpper(base.LocalName); } return base.LocalName; } } /// <summary>See <see cref="XmlReader.Name"/></summary> public override string Name { get { // Again, if this is a NS declaration, pass as-is. if (base.NamespaceURI == XmlNamespaces.XmlNs) return base.Name; // If there's no prefix, capitalize it directly. if (base.Name.IndexOf(":") == -1) return MakeFirstUpper(base.Name); else { // Turn local name into upper, not the prefix. string name = base.Name.Substring(0, base.Name.IndexOf(":") + 1); name += MakeFirstUpper(base.Name.Substring(base.Name.IndexOf(":") + 1)); return NameTable.Add(name); } } } #endregion Properties #region Methods /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> public override bool MoveToAttribute(string name, string ns) { return base.MoveToAttribute( NameTable.Add(XmlFirstLowerWriter.MakeFirstLower(name)), ns); } #endregion Methods } } --- NEW FILE: AssemblyInfo.cs --- using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Permissions; [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: AssemblyTitle("Mvp.Xml.Common")] [assembly: AssemblyDescription("MVP XML Library - Common Module")] [assembly: AssemblyVersion("2.0.*")] #region Security Permissions //[assembly: SecurityPermission(SecurityAction.RequestRefuse, UnmanagedCode=true)] #endregion Security Permissions --- NEW FILE: XmlPrefix.cs --- #region using using System; using System.Xml; #endregion using namespace Mvp.Xml.Common { /// <summary> /// Represents a mapping between a prefix and a namespace. /// </summary> public class XmlPrefix { /// <summary> /// Creates the prefix mapping. /// </summary> /// <param name="prefix">Prefix associated with the namespace.</param> /// <param name="ns">Namespace to associate with the prefix.</param> public XmlPrefix(string prefix, string ns) { _prefix = prefix; _ns = ns; } /// <summary> /// Creates the prefix mapping, using atomized strings from the /// <paramref name="nameTable"/> for faster lookups and comparisons. /// </summary> /// <param name="prefix">Prefix associated with the namespace.</param> /// <param name="ns">Namespace to associate with the prefix.</param> /// <param name="nameTable">The name table to use to atomize strings.</param> /// <remarks> /// This is the recommended way to construct this class, as it uses the /// best approach to handling strings in XML. /// </remarks> public XmlPrefix(string prefix, string ns, XmlNameTable nameTable) { _prefix = nameTable.Add( prefix ); _ns = nameTable.Add( ns ); } /// <summary> /// Gets the prefix associated with the <see cref="NamespaceURI"/>. /// </summary> public string Prefix { get { return _prefix; } } string _prefix; /// <summary> /// Gets the namespace associated with the <see cref="Prefix"/>. /// </summary> public string NamespaceURI { get { return _ns; } } string _ns; } } --- NEW FILE: XmlBaseAwareXmlTextReader.cs --- #region using using System; using System.Xml; using System.IO; using System.Collections.Generic; #endregion namespace Mvp.Xml.Common { /// <summary> /// XmlTextReader supporting <a href="http://www.w3.org/TR/xmlbase/">XML Base</a>. /// </summary> public class XmlBaseAwareXmlTextReader : XmlTextReader { #region private private XmlBaseState _state = new XmlBaseState(); private Stack<XmlBaseState> _states = null; #endregion #region constructors /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given URI. /// </summary> public XmlBaseAwareXmlTextReader(string uri) : base(uri) { _state.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) { _state.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) { _state.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) { _state.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) { _state.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) { _state.BaseUri = new Uri(base.BaseURI); } #endregion #region XmlTextReader overrides /// <summary> /// See <see cref="XmlTextReader.BaseURI"/>. /// </summary> public override string BaseURI { get { return _state.BaseUri==null? "" : _state.BaseUri.AbsoluteUri; } } /// <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; } #endregion } internal class XmlBaseState { public XmlBaseState() {} public XmlBaseState(Uri baseUri, int depth) { this.BaseUri = baseUri; this.Depth = depth; } public Uri BaseUri; public int Depth; } } --- NEW FILE: SR.resx --- <?xml version="1.0" encoding="utf-8" ?> <root> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="ResMimeType"> <value>text/microsoft-resx</value> </resheader> <resheader name="Version"> <value>1.0.0.0</value> </resheader> <resheader name="Reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="Writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="XmlNodeListFactory_IHasXmlNodeMissing" type="System.String" mimetype="System.String"> <value>The XPath query was not executed against an XmlNode-based object (such as XmlDocument).</value> <comment>The factory received an XPathNodeIterator that was not obtained from querying an XmlDocument or XmlNode.</comment> </data> <data name="IndexingXPathNavigator_KeyWrongArguments" type="System.String" mimetype="System.String"> <value>Wrong number of arguments of key() function.</value> <comment>The key() function was called with invalid number of args.</comment> </data> <data name="IndexingXPathNavigator_KeyArgumentNotString" type="System.String" mimetype="System.String"> <value>Type of the first argument of key() function must be string.</value> </data> <data name="XmlFragmentStream_EOF" type="System.String" mimetype="System.String"> <value>Attempt to read past EOF.</value> <comment>The read method was called while the class is already in EOF.</comment> </data> <data name="XPathCache_BadSortObject" type="System.String" mimetype="System.String"> <value>Sort expression must be either a string or an XPathExpression.</value> <comment>Sort expression is invalid.</comment> </data> <data name="XmlDocumentFactory_NotImplementedDOM" type="System.String" mimetype="System.String"> <value>The XmlDocument instance can only be used for serialization purposes.</value> <comment>All methods except for WriteTo() are unimplemented.</comment> </data> <data name="XPathNavigatorIterator_CantAddAfterMove" type="System.String" mimetype="System.String"> <value>Can't add new elements after the iterator has moved.</value> <comment>Can't add new elements after the iterator has moved.</comment> </data> </root> --- NEW FILE: SR.cs --- //------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Runtime Version: 1.1.4322.573 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ namespace Mvp.Xml.Common { using System; using System.Resources; using System.Threading; /// <summary>Contains resources for the application.</summary> sealed class SR { private static ResourceManager _resourceManager = new ResourceManager(typeof(SR).FullName, typeof(SR).Module.Assembly); private SR() { } /// <summary> /// Gets the specified resource for the <see cref='Thread.CurrentUICulture'/>. /// </summary> /// <param name='key'>The key of the resource to retrieve.</param> /// <returns>The object resource.</returns> internal static object GetObject(string key) { return _resourceManager.GetObject(key); } /// <summary> /// Gets the specified resource for the <see cref='Thread.CurrentUICulture'/>. /// </summary> /// <param name='key'>The key of the resource to retrieve.</param> /// <returns>The string resource.</returns> internal static string GetString(string key) { return _resourceManager.GetString(key); } /// <summary> /// Gets the specified resource for the <see cref='Thread.CurrentUICulture'/> and /// formats it with the arguments received. /// </summary> /// <param name='key'>The key of the resource to retrieve.</param> /// <param name='args'>The arguments to format the resource with.</param> /// <returns>The string resource.</returns> internal static string GetString(string key, params object[] args) { return String.Format(GetString(key), args); } /// <summary>The factory received an XPathNodeIterator that was not obtained from querying an XmlDocument or XmlNode.</summary> public static string XmlNodeListFactory_IHasXmlNodeMissing { get { return SR.GetString("XmlNodeListFactory_IHasXmlNodeMissing"); } } /// <summary>The key() function was called with invalid number of args.</summary> public static string IndexingXPathNavigator_KeyWrongArguments { get { return SR.GetString("IndexingXPathNavigator_KeyWrongArguments"); } } /// <summary></summary> public static string IndexingXPathNavigator_KeyArgumentNotString { get { return SR.GetString("IndexingXPathNavigator_KeyArgumentNotString"); } } /// <summary>The read method was called while the class is already in EOF.</summary> public static string XmlFragmentStream_EOF { get { return SR.GetString("XmlFragmentStream_EOF"); } } /// <summary>Sort expression is invalid.</summary> public static string XPathCache_BadSortObject { get { return SR.GetString("XPathCache_BadSortObject"); } } /// <summary>All methods except for WriteTo() are unimplemented.</summary> public static string XmlDocumentFactory_NotImplementedDOM { get { return SR.GetString("XmlDocumentFactory_NotImplementedDOM"); } } /// <summary>Can't add new elements after the iterator has moved.</summary> public static string XPathNavigatorIterator_CantAddAfterMove { get { return SR.GetString("XPathNavigatorIterator_CantAddAfterMove"); } } } } --- NEW FILE: XmlNamespaces.cs --- #region using using System; #endregion using namespace Mvp.Xml.Common { /// <summary> /// Provides public constants for wellknown XML namespaces. /// </summary> /// <remarks>Author: Daniel Cazzulino, kz...@gm...</remarks> public sealed class XmlNamespaces { #region Ctor private XmlNamespaces() {} #endregion Ctor #region Public Constants /// <summary> /// The public XML 1.0 namespace. /// </summary> /// <remarks>See http://www.w3.org/TR/2004/REC-xml-20040204/</remarks> public const string Xml = "http://www.w3.org/XML/1998/namespace"; /// <summary> /// Public Xml Namespaces specification namespace. /// </summary> /// <remarks>See http://www.w3.org/TR/REC-xml-names/</remarks> public const string XmlNs = "http://www.w3.org/2000/xmlns/"; /// <summary> /// Public Xml Namespaces prefix. /// </summary> /// <remarks>See http://www.w3.org/TR/REC-xml-names/</remarks> public const string XmlNsPrefix = "xmlns"; /// <summary> /// XML Schema instance namespace. /// </summary> /// <remarks>See http://www.w3.org/TR/xmlschema-1/</remarks> public const string Xsi = "http://www.w3.org/2001/XMLSchema-instance"; /// <summary> /// XML 1.0 Schema namespace. /// </summary> /// <remarks>See http://www.w3.org/TR/xmlschema-1/</remarks> public const string Xsd = "http://www.w3.org/2001/XMLSchema"; #endregion Public Constants } } |