You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(174) |
Nov
(85) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(56) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(1) |
Jul
(132) |
Aug
(5) |
Sep
|
Oct
(314) |
Nov
(133) |
Dec
(18) |
2006 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Oleg T. <he...@us...> - 2005-10-28 20:02:01
|
Update of /cvsroot/mvp-xml/Common/v2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21156/v2/src Modified Files: Common.csproj Log Message: Index: Common.csproj =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/Common.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Common.csproj 25 Oct 2005 21:33:43 -0000 1.4 +++ Common.csproj 28 Oct 2005 20:01:47 -0000 1.5 @@ -77,6 +77,8 @@ <Reference Include="System"> <Name>System</Name> </Reference> + <Reference Include="System.Configuration.Install" /> + <Reference Include="System.Management" /> <Reference Include="System.Xml"> <Name>System.XML</Name> </Reference> @@ -85,6 +87,15 @@ <Compile Include="AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Serialization\CacheKeyFactory.cs" /> + <Compile Include="Serialization\PerfCounterInstaller.cs"> + <SubType>Component</SubType> + </Compile> + <Compile Include="Serialization\PerfCounterManager.cs" /> + <Compile Include="Serialization\SignatureExtractor.cs" /> + <Compile Include="Serialization\StringSorter.cs" /> + <Compile Include="Serialization\XmlAttributeOverridesThumbprinter.cs" /> + <Compile Include="Serialization\XmlSerializerCache.cs" /> <Compile Include="SR.cs"> <SubType>Code</SubType> </Compile> @@ -131,6 +142,10 @@ <SubType>Code</SubType> </Compile> <Content Include="changelog.txt" /> + <EmbeddedResource Include="Serialization\PerfCounterInstaller.resx"> + <DependentUpon>PerfCounterInstaller.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> <EmbeddedResource Include="SR.resx"> <DependentUpon>SR.cs</DependentUpon> </EmbeddedResource> |
From: Oleg T. <he...@us...> - 2005-10-28 20:01:56
|
Update of /cvsroot/mvp-xml/Common/v2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21156/v2/test Modified Files: CommonTest.csproj IndexingXPathNavigatorTest.cs Log Message: Index: CommonTest.csproj =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/test/CommonTest.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CommonTest.csproj 26 Oct 2005 15:08:30 -0000 1.2 +++ CommonTest.csproj 28 Oct 2005 20:01:48 -0000 1.3 @@ -143,6 +143,24 @@ <Compile Include="XmlNodeListFactoryTests.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="XmlSerializerCacheTests\PerfCounterManagerTests.cs" /> + <Compile Include="XmlSerializerCacheTests\PerfCounterTests.cs" /> + <Compile Include="XmlSerializerCacheTests\StringSorterHelperTests.cs" /> + <Compile Include="XmlSerializerCacheTests\ThumbprintHelpers.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlAnyElementThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlArrayItemThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlArrayThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlAttributeOverridesThumbprinterTester.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlAttributeThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlChoiceIndetifierPrintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlDefaultValuePrintTest.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlElementThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlEnumAttributeThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlIgnoreThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlNamespaceThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlRootThumbprintTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlSerializerCacheTests.cs" /> + <Compile Include="XmlSerializerCacheTests\XmlTextThumbprintTests.cs" /> <Compile Include="XPathCacheTests.cs"> <SubType>Code</SubType> </Compile> Index: IndexingXPathNavigatorTest.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/test/IndexingXPathNavigatorTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IndexingXPathNavigatorTest.cs 25 Oct 2005 21:33:44 -0000 1.1 +++ IndexingXPathNavigatorTest.cs 28 Oct 2005 20:01:48 -0000 1.2 @@ -22,7 +22,7 @@ [STAThread] static void Main(string[] args) - { + { Stopwatch stopWatch = new Stopwatch(); int repeat = 1000; stopWatch.Start(); |
From: Oleg T. <he...@us...> - 2005-10-28 20:01:56
|
Update of /cvsroot/mvp-xml/Common/v2/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21156/v2/src/XPath Modified Files: DynamicContext.cs IndexingXPathNavigator.cs XPathCache.cs Log Message: Index: DynamicContext.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/DynamicContext.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DynamicContext.cs 25 Oct 2005 21:33:44 -0000 1.2 +++ DynamicContext.cs 28 Oct 2005 20:01:47 -0000 1.3 @@ -210,7 +210,9 @@ /// </summary> public override IXsltContextVariable ResolveVariable(string prefix, string name) { - return _variables[name]; + IXsltContextVariable var; + _variables.TryGetValue(name, out var); + return var; } #endregion Variable Handling Code Index: XPathCache.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/XPathCache.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- XPathCache.cs 26 Oct 2005 15:08:29 -0000 1.3 +++ XPathCache.cs 28 Oct 2005 20:01:47 -0000 1.4 @@ -41,23 +41,19 @@ /// <summary> /// Retrieves a cached compiled expression, or a newly compiled one. /// </summary> - private static XPathExpression GetCompiledExpression(string expression, XPathNavigator source) - { - XPathExpression expr; + private static XPathExpression GetCompiledExpression(string expression, XPathNavigator source) + { + XPathExpression expr; - if (Cache.ContainsKey(expression)) - { - expr = Cache[expression]; - } - else - { - // No double checks. At most we will compile twice. No big deal. - expr = source.Compile(expression); - Cache[expression] = expr; - } + if (!Cache.TryGetValue(expression, out expr)) + { + // No double checks. At most we will compile twice. No big deal. + expr = source.Compile(expression); + Cache[expression] = expr; + } - return expr.Clone(); - } + return expr.Clone(); + } /// <summary> /// Sets up the context for expression execution. Index: IndexingXPathNavigator.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/IndexingXPathNavigator.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- IndexingXPathNavigator.cs 26 Oct 2005 16:15:42 -0000 1.3 +++ IndexingXPathNavigator.cs 28 Oct 2005 20:01:47 -0000 1.4 @@ -687,15 +687,11 @@ { //Get slot List<XPathNavigator> indexedNodes; - if (index.ContainsKey(key)) - { - indexedNodes = index[key]; - } - else + if (!index.TryGetValue(key, out indexedNodes)) { indexedNodes = new List<XPathNavigator>(); index.Add(key, indexedNodes); - } + } indexedNodes.Add(node.Clone()); } } @@ -727,15 +723,11 @@ if (indexes == null) indexes = new Dictionary<string, XPathNavigatorIndex>(); XPathNavigatorIndex index; - if (indexes.ContainsKey(indexName)) - { - index = indexes[indexName]; - } - else + if (!indexes.TryGetValue(indexName, out index)) { - index = new XPathNavigatorIndex(); - indexes.Add(indexName, index); - } + index = new XPathNavigatorIndex(); + indexes.Add(indexName, index); + } index.AddKey(key); } @@ -793,7 +785,8 @@ { if (!indexed) BuildIndexes(); - XPathNavigatorIndex index = indexes[indexName]; + XPathNavigatorIndex index; + indexes.TryGetValue(indexName, out index); return index == null? null : index.GetNodes(value); } } |
From: Oleg T. <he...@us...> - 2005-10-26 16:15:50
|
Update of /cvsroot/mvp-xml/Common/v2/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27809/v2/src/XPath Modified Files: IndexingXPathNavigator.cs Log Message: Index: IndexingXPathNavigator.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/IndexingXPathNavigator.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- IndexingXPathNavigator.cs 25 Oct 2005 21:33:44 -0000 1.2 +++ IndexingXPathNavigator.cs 26 Oct 2005 16:15:42 -0000 1.3 @@ -621,23 +621,24 @@ //converted to a string as if by a call to the string function; it //returns a node-set containing the nodes in the same document as //the context node that have a value for the named key equal to this string. - List<XPathNavigator> indexedNodes = null; + List<XPathNavigator> indexedNodes = null, tmpIndexedNodes; if (keyValue is XPathNodeIterator) { XPathNodeIterator nodes = keyValue as XPathNodeIterator; while (nodes.MoveNext()) { - if (index.ContainsKey(nodes.Current.Value)) + + if (index.TryGetValue(nodes.Current.Value, out tmpIndexedNodes)) { if (indexedNodes == null) indexedNodes = new List<XPathNavigator>(); - indexedNodes.AddRange(index[nodes.Current.Value]); + indexedNodes.AddRange(tmpIndexedNodes); } } } else { - indexedNodes = index[keyValue.ToString()]; + index.TryGetValue(keyValue.ToString(), out indexedNodes); } if (indexedNodes == null) indexedNodes = new List<XPathNavigator>(0); |
Update of /cvsroot/mvp-xml/XPointer/v2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18400/v2/src Modified Files: AssemblyInfo.cs ElementSchemaPointerPart.cs XPath1SchemaPointerPart.cs XPointer.csproj XPointerParser.cs XPointerReader.cs XmlnsSchemaPointerPart.cs Log Message: Index: XmlnsSchemaPointerPart.cs =================================================================== RCS file: /cvsroot/mvp-xml/XPointer/v2/src/XmlnsSchemaPointerPart.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- XmlnsSchemaPointerPart.cs 16 Oct 2005 16:02:15 -0000 1.2 +++ XmlnsSchemaPointerPart.cs 26 Oct 2005 15:46:35 -0000 1.3 @@ -3,6 +3,7 @@ using System; using System.Xml; using System.Xml.XPath; +using System.Diagnostics; #endregion @@ -36,6 +37,21 @@ #endregion + + #region properties + public string Prefix + { + get { return _prefix; } + set { _prefix = value; } + } + public string Uri + { + get { return _uri; } + set { _uri = value; } + } + #endregion + + #region PointerPart overrides /// <summary> Index: XPath1SchemaPointerPart.cs =================================================================== RCS file: /cvsroot/mvp-xml/XPointer/v2/src/XPath1SchemaPointerPart.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- XPath1SchemaPointerPart.cs 16 Oct 2005 16:02:15 -0000 1.2 +++ XPath1SchemaPointerPart.cs 26 Oct 2005 15:46:35 -0000 1.3 @@ -50,7 +50,7 @@ XPath1SchemaPointerPart part = new XPath1SchemaPointerPart(); try { - part.XPath = lexer.ParseEscapedData(); + part._xpath = lexer.ParseEscapedData(); } catch (Exception e) { Index: XPointer.csproj =================================================================== RCS file: /cvsroot/mvp-xml/XPointer/v2/src/XPointer.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- XPointer.csproj 16 Oct 2005 16:02:15 -0000 1.2 +++ XPointer.csproj 26 Oct 2005 15:46:35 -0000 1.3 @@ -26,6 +26,7 @@ </FileUpgradeFlags> <UpgradeBackupLocation> </UpgradeBackupLocation> + <SignAssembly>true</SignAssembly> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <OutputPath>bin\Debug\</OutputPath> @@ -84,39 +85,35 @@ </Reference> </ItemGroup> <ItemGroup> - <Compile Include="..\..\..\Common\v1\src\SR.cs"> + <Compile Include="..\..\..\Common\v2\src\SR.cs"> <Link>Common\SR.cs</Link> <SubType>Code</SubType> </Compile> - <Compile Include="..\..\..\Common\v1\src\XmlNamespaces.cs"> + <Compile Include="..\..\..\Common\v2\src\XmlNamespaces.cs"> <Link>Common\XmlNamespaces.cs</Link> <SubType>Code</SubType> </Compile> - <Compile Include="..\..\..\Common\v1\src\XmlNodeListFactory.cs"> + <Compile Include="..\..\..\Common\v2\src\XmlNodeListFactory.cs"> <Link>Common\XmlNodeListFactory.cs</Link> <SubType>Code</SubType> </Compile> - <Compile Include="..\..\..\Common\v1\src\XmlPrefix.cs"> + <Compile Include="..\..\..\Common\v2\src\XmlPrefix.cs"> <Link>Common\XmlPrefix.cs</Link> <SubType>Code</SubType> </Compile> - <Compile Include="..\..\..\Common\v1\src\XPath\DynamicContext.cs"> + <Compile Include="..\..\..\Common\v2\src\XPath\DynamicContext.cs"> <Link>Common\XPath\DynamicContext.cs</Link> <SubType>Code</SubType> </Compile> - <Compile Include="..\..\..\Common\v1\src\XPath\IHasXPathNavigator.cs"> + <Compile Include="..\..\..\Common\v2\src\XPath\IHasXPathNavigator.cs"> <Link>Common\XPath\IHasXPathNavigator.cs</Link> <SubType>Code</SubType> </Compile> - <Compile Include="..\..\..\Common\v1\src\XPath\XPathCache.cs"> + <Compile Include="..\..\..\Common\v2\src\XPath\XPathCache.cs"> <Link>Common\XPath\XPathCache.cs</Link> <SubType>Code</SubType> </Compile> - <Compile Include="..\..\..\Common\v1\src\XPath\XPathNavigatorReader.cs"> - <Link>Common\XPath\XPathNavigatorReader.cs</Link> - <SubType>Code</SubType> - </Compile> - <Compile Include="..\..\..\Common\v1\src\XPath\XPathVariable.cs"> + <Compile Include="..\..\..\Common\v2\src\XPath\XPathVariable.cs"> <Link>Common\XPath\XPathVariable.cs</Link> <SubType>Code</SubType> </Compile> @@ -172,7 +169,7 @@ <SubType>Code</SubType> </Compile> <Content Include="changelog.txt" /> - <EmbeddedResource Include="..\..\..\Common\v1\src\SR.resx"> + <EmbeddedResource Include="..\..\..\Common\v2\src\SR.resx"> <Link>Common\SR.resx</Link> <DependentUpon>SR.cs</DependentUpon> </EmbeddedResource> Index: XPointerParser.cs =================================================================== RCS file: /cvsroot/mvp-xml/XPointer/v2/src/XPointerParser.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- XPointerParser.cs 16 Oct 2005 16:02:15 -0000 1.2 +++ XPointerParser.cs 26 Oct 2005 15:46:35 -0000 1.3 @@ -44,8 +44,8 @@ } else schemaNSURI = String.Empty; - XPointerSchema.SchemaType schemaType = _schemas[schemaNSURI + ':' + lexer.NCName]; - return schemaType != null ? schemaType : XPointerSchema.SchemaType.Unknown; + string schemaQName = schemaNSURI + ':' + lexer.NCName; + return _schemas.ContainsKey(schemaQName)? _schemas[schemaQName] : XPointerSchema.SchemaType.Unknown; } Index: ElementSchemaPointerPart.cs =================================================================== RCS file: /cvsroot/mvp-xml/XPointer/v2/src/ElementSchemaPointerPart.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ElementSchemaPointerPart.cs 16 Oct 2005 16:02:15 -0000 1.2 +++ ElementSchemaPointerPart.cs 26 Oct 2005 15:46:35 -0000 1.3 @@ -4,6 +4,7 @@ using System.Xml.XPath; using System.Xml; using System.Text; +using System.Diagnostics; using Mvp.Xml.Common.XPath; @@ -97,7 +98,7 @@ { throw new XPointerSyntaxException(SR.InvalidTokenInElementSchemeWhileClosingRoundBracketExpected); } - if (part.NCName == null && childSequenceLen == 0) + if (xpathBuilder.Length == 0 && childSequenceLen == 0) { Debug.WriteLine(SR.EmptyElementSchemeXPointer); return null; Index: XPointerReader.cs =================================================================== RCS file: /cvsroot/mvp-xml/XPointer/v2/src/XPointerReader.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- XPointerReader.cs 16 Oct 2005 16:02:15 -0000 1.2 +++ XPointerReader.cs 26 Oct 2005 15:46:35 -0000 1.3 @@ -42,7 +42,7 @@ _pointedNodes = pointer.Evaluate(nav); //There is always at least one identified node //XPathNodeIterator is already at the first node - _reader = new XPathNavigatorReader(_pointedNodes.Current); + _reader = _pointedNodes.Current.ReadSubtree(); } private XPathDocument CreateAndCacheDocument(XmlReader r, bool supportSchemaDeterminedIDs) @@ -300,19 +300,19 @@ get { return _reader.EOF; } } - /// <summary>See <see cref="XmlReader.GetAttribute"/>.</summary> + /// <summary>See <see cref="XmlReader.GetAttribute(int)"/>.</summary> public override string GetAttribute(int i) { return _reader.GetAttribute(i); } - /// <summary>See <see cref="XmlReader.GetAttribute"/>.</summary> + /// <summary>See <see cref="XmlReader.GetAttribute(string)"/>.</summary> public override string GetAttribute(string name) { return _reader.GetAttribute(name); } - /// <summary>See <see cref="XmlReader.GetAttribute"/>.</summary> + /// <summary>See <see cref="XmlReader.GetAttribute(string, string)"/>.</summary> public override string GetAttribute(string name, string namespaceURI) { return _reader.GetAttribute(name, namespaceURI); @@ -330,19 +330,19 @@ return _reader.LookupNamespace(prefix); } - /// <summary>See <see cref="XmlReader.MoveToAttribute"/>.</summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute(int)"/>.</summary> public override void MoveToAttribute(int i) { _reader.MoveToAttribute(i); } - /// <summary>See <see cref="XmlReader.MoveToAttribute"/>.</summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute(string)"/>.</summary> public override bool MoveToAttribute(string name) { return _reader.MoveToAttribute(name); } - /// <summary>See <see cref="XmlReader.MoveToAttribute"/>.</summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/>.</summary> public override bool MoveToAttribute(string name, string ns) { return _reader.MoveToAttribute(name, ns); @@ -378,19 +378,19 @@ get { return _reader.ReadState; } } - /// <summary>See <see cref="XmlReader.this"/>.</summary> + /// <summary>See <see cref="XmlReader.this[int]"/>.</summary> public override String this[int i] { get { return _reader[i]; } } - /// <summary>See <see cref="XmlReader.this"/>.</summary> + /// <summary>See <see cref="XmlReader.this[string]"/>.</summary> public override string this[string name] { get { return _reader[name]; } } - /// <summary>See <see cref="XmlReader.this"/>.</summary> + /// <summary>See <see cref="XmlReader.this[string, string]"/>.</summary> public override string this[string name, string namespaceURI] { get { return _reader[name, namespaceURI]; } Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/mvp-xml/XPointer/v2/src/AssemblyInfo.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.cs 16 Oct 2005 15:17:03 -0000 1.1 +++ AssemblyInfo.cs 26 Oct 2005 15:46:35 -0000 1.2 @@ -11,9 +11,6 @@ [assembly: AssemblyDescription("MVP XML Library - XPointer.NET Module")] [assembly: AssemblyVersion("2.0.*")] -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("../../../../../Global/v1/mvp-xml.snk")] -[assembly: AssemblyKeyName("")] #region Security Permissions |
From: Oleg T. <he...@us...> - 2005-10-26 15:46:46
|
Update of /cvsroot/mvp-xml/XPointer/v2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18400/v2/test Modified Files: XPointerTest.csproj Log Message: Index: XPointerTest.csproj =================================================================== RCS file: /cvsroot/mvp-xml/XPointer/v2/test/XPointerTest.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- XPointerTest.csproj 16 Oct 2005 15:17:03 -0000 1.1 +++ XPointerTest.csproj 26 Oct 2005 15:46:35 -0000 1.2 @@ -93,11 +93,6 @@ <Project>{E0E9C344-ABB5-4CE9-A055-DECB508298E7}</Project> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> </ProjectReference> - <ProjectReference Include="CommonTest"> - <Name>CommonTest</Name> - <Project>{17955FFF-E5FC-43B8-B390-86E370658CB1}</Project> - <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> - </ProjectReference> </ItemGroup> <ItemGroup> <Content Include="changelog.txt" /> @@ -117,7 +112,6 @@ <None Include="pubNS.xsx"> <DependentUpon>pubNS.xsd</DependentUpon> </None> - <EmbeddedResource Include="pubs.xml" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <PropertyGroup> |
From: Oleg T. <he...@us...> - 2005-10-26 15:08:41
|
Update of /cvsroot/mvp-xml/Common/v2/test/UpperLowerTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10046/v2/test/UpperLowerTests Modified Files: FirstUpperLowerTests.cs Log Message: Index: FirstUpperLowerTests.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/test/UpperLowerTests/FirstUpperLowerTests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FirstUpperLowerTests.cs 25 Oct 2005 21:33:44 -0000 1.1 +++ FirstUpperLowerTests.cs 26 Oct 2005 15:08:30 -0000 1.2 @@ -91,7 +91,7 @@ ser.Serialize(fl, c); - Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-16\"?><customer xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" id=\"0736\" xmlns=\"mvp-xml-customer\"><name>Daniel Cazzulino</name><order id=\"25\" /></customer>", + Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-16\"?><customer xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" id=\"0736\" xmlns=\"mvp-xml-customer\"><name>Daniel Cazzulino</name><order id=\"25\" /></customer>", sw.ToString()); } } |
From: Oleg T. <he...@us...> - 2005-10-26 15:08:41
|
Update of /cvsroot/mvp-xml/Common/v2/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10046/v2/src/XPath Modified Files: XPathCache.cs Log Message: Index: XPathCache.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/XPathCache.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- XPathCache.cs 25 Oct 2005 21:33:44 -0000 1.2 +++ XPathCache.cs 26 Oct 2005 15:08:29 -0000 1.3 @@ -43,11 +43,15 @@ /// </summary> private static XPathExpression GetCompiledExpression(string expression, XPathNavigator source) { - XPathExpression expr = Cache[expression]; + XPathExpression expr; - // No double checks. At most we will compile twice. No big deal. - if (expr == null) - { + if (Cache.ContainsKey(expression)) + { + expr = Cache[expression]; + } + else + { + // No double checks. At most we will compile twice. No big deal. expr = source.Compile(expression); Cache[expression] = expr; } |
From: Oleg T. <he...@us...> - 2005-10-26 15:08:41
|
Update of /cvsroot/mvp-xml/Common/v2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10046/v2/test Modified Files: CommonTest.csproj XPathSortBug.cs Log Message: Index: XPathSortBug.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/test/XPathSortBug.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- XPathSortBug.cs 25 Oct 2005 21:33:44 -0000 1.1 +++ XPathSortBug.cs 26 Oct 2005 15:08:30 -0000 1.2 @@ -38,13 +38,14 @@ XPathExpression sort = nav.Compile("mvp:value"); sort.SetContext(ctx); - // Setting the sort *after* the context yields no results at all. + // Setting the sort *after* the context yields no results at all in .NET 1.X + // but works in .NET 2.0 XPathExpression items = nav.Compile("//mvp:item"); items.AddSort(sort, XmlSortOrder.Ascending, XmlCaseOrder.None, String.Empty, XmlDataType.Number); items.SetContext(ctx); XPathNodeIterator it = doc.CreateNavigator().Select(items); - Assert.IsFalse( it.MoveNext() ); + Assert.IsTrue( it.MoveNext() ); // The same code but setting the sort *after* the context works fine. items = nav.Compile("//mvp:item"); Index: CommonTest.csproj =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/test/CommonTest.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CommonTest.csproj 25 Oct 2005 21:33:44 -0000 1.1 +++ CommonTest.csproj 26 Oct 2005 15:08:30 -0000 1.2 @@ -156,7 +156,6 @@ <SubType>Code</SubType> </Compile> <Content Include="changelog.txt" /> - <Content Include="issues.txt" /> <EmbeddedResource Include="library.xml" /> <EmbeddedResource Include="northwind.xml" /> <EmbeddedResource Include="pubs.xml" /> |
From: Daniel C. <kz...@gm...> - 2005-10-26 05:36:29
|
I was wondering whether those two hacky classes XmlFirstUpperReader and XmlFirstLowerWriter should be in a serious library.... looks like we could generalize these kinds of mini-transformation in a generic XmlTransformingReader and XmlTransformingWriter that can receive a delegate to the transforming code, in the two cases above, turning the first letter into upper/lower case... thoughts? On 10/25/05, mvp...@li... < mvp...@li...> wrote: > > Send mvp-xml-cvs mailing list submissions to > mvp...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/mvp-xml-cvs > or, via email, send a message with subject or body 'help' to > mvp...@li... > > You can reach the person managing the list at > mvp...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of mvp-xml-cvs digest..." > > > Today's Topics: > > 1. Common/v2/test/XmlFragments Tests.cs,NONE,1.1 publishers.xml,NONE,1.1(= Oleg Tkachenko) > 2. Common/v2/test/UpperLowerTests Customer.cs,NONE,1.1 Customer.xml,NONE, > 1.1 Customer.xsd,NONE,1.1 Customer.xsx,NONE,1.1 FirstUpperLowerTests.cs > ,NONE,1.1 (Oleg Tkachenko) > > --__--__-- > > Message: 1 > From: Oleg Tkachenko <he...@us...> > To: mvp...@li... > Date: Tue, 25 Oct 2005 21:33:46 +0000 > Subject: [mvp-xml-cvs] Common/v2/test/XmlFragments Tests.cs,NONE,1.1 > publishers.xml,NONE,1.1 > > Update of /cvsroot/mvp-xml/Common/v2/test/XmlFragments > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/test/XmlFragments > > Added Files: > Tests.cs publishers.xml > Log Message: > > > --- NEW FILE: publishers.xml --- > <publishers> > <pub_id>0736</pub_id> > <pub_name>New Moon Books</pub_name> > <city>Boston</city> > <state>MA</state> > <country>USA</country> > <titles> > <title_id>BU2075</title_id> > <title>You Can Combat Computer Stress!</title> > <type>business </type> > <pub_id>0736</pub_id> > <price>2.99</price> > <advance>10125</advance> > <royalty>24</royalty> > <ytd_sales>18722</ytd_sales> > <notes>The latest medical and psychological techniques for living with th= e > electronic office. Easy-to-understand explanations.</notes> > <pubdate>1991-06-30T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>PS2091</title_id> > <title>Is Anger the Enemy?</title> > <type>psychology </type> > <pub_id>0736</pub_id> > <price>10.95</price> > <advance>2275</advance> > <royalty>12</royalty> > <ytd_sales>2045</ytd_sales> > <notes>Carefully researched study of the effects of strong emotions on th= e > body. Metabolic charts included.</notes> > <pubdate>1991-06-15T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>PS2106</title_id> > <title>Life Without Fear</title> > <type>psychology </type> > <pub_id>0736</pub_id> > <price>7</price> > <advance>6000</advance> > <royalty>10</royalty> > <ytd_sales>111</ytd_sales> > <notes>New exercise, meditation, and nutritional techniques that can > reduce the shock of daily interactions. Popular audience. Sample menus > included, exercise video available separately.</notes> > <pubdate>1991-10-05T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>PS3333</title_id> > <title>Prolonged Data Deprivation: Four Case Studies</title> > <type>psychology </type> > <pub_id>0736</pub_id> > <price>19.99</price> > <advance>2000</advance> > <royalty>10</royalty> > <ytd_sales>4072</ytd_sales> > <notes>What happens when the data runs dry? Searching evaluations of > information-shortage effects.</notes> > <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>PS7777</title_id> > <title>Emotional Security: A New Algorithm</title> > <type>psychology </type> > <pub_id>0736</pub_id> > <price>7.99</price> > <advance>4000</advance> > <royalty>10</royalty> > <ytd_sales>3336</ytd_sales> > <notes>Protecting yourself and your loved ones from undue emotional stres= s > in the modern world. Use of computer and nutritional aids > emphasized.</notes> > <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> > </titles> > </publishers> > <publishers> > <pub_id>0877</pub_id> > <pub_name>Binnet & Hardley</pub_name> > <city>Washington</city> > <state>DC</state> > <country>USA</country> > <titles> > <title_id>MC2222</title_id> > <title>Silicon Valley Gastronomic Treats</title> > <type>mod_cook </type> > <pub_id>0877</pub_id> > <price>19.99</price> > <advance>0</advance> > <royalty>12</royalty> > <ytd_sales>2032</ytd_sales> > <notes>Favorite recipes for quick, easy, and elegant meals.</notes> > <pubdate>1991-06-09T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>MC3021</title_id> > <title>The Gourmet Microwave</title> > <type>mod_cook </type> > <pub_id>0877</pub_id> > <price>2.99</price> > <advance>15000</advance> > <royalty>24</royalty> > <ytd_sales>22246</ytd_sales> > <notes>Traditional French gourmet recipes adapted for modern microwave > cooking.</notes> > <pubdate>1991-06-18T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>MC3026</title_id> > <title>The Psychology of Computer Cooking</title> > <type>UNDECIDED </type> > <pub_id>0877</pub_id> > <pubdate>2000-08-06T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>PS1372</title_id> > <title>Computer Phobic AND Non-Phobic Individuals: Behavior > Variations</title> > <type>psychology </type> > <pub_id>0877</pub_id> > <price>21.59</price> > <advance>7000</advance> > <royalty>10</royalty> > <ytd_sales>375</ytd_sales> > <notes>A must for the specialist, this book examines the difference > between those who hate and fear computers and those who don't.</notes> > <pubdate>1991-10-21T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>TC3218</title_id> > <title>Onions, Leeks, and Garlic: Cooking Secrets of the > Mediterranean</title> > <type>trad_cook </type> > <pub_id>0877</pub_id> > <price>20.95</price> > <advance>7000</advance> > <royalty>10</royalty> > <ytd_sales>375</ytd_sales> > <notes>Profusely illustrated in color, this makes a wonderful gift book > for a cuisine-oriented friend.</notes> > <pubdate>1991-10-21T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>TC4203</title_id> > <title>Fifty Years in Buckingham Palace Kitchens</title> > <type>trad_cook </type> > <pub_id>0877</pub_id> > <price>11.95</price> > <advance>4000</advance> > <royalty>14</royalty> > <ytd_sales>15096</ytd_sales> > <notes>More anecdotes from the Queen's favorite cook describing life amon= g > English royalty. Recipes, techniques, tender vignettes.</notes> > <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>TC7777</title_id> > <title>Sushi, Anyone?</title> > <type>trad_cook </type> > <pub_id>0877</pub_id> > <price>14.99</price> > <advance>8000</advance> > <royalty>10</royalty> > <ytd_sales>4095</ytd_sales> > <notes>Detailed instructions on how to make authentic Japanese sushi in > your spare time.</notes> > <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> > </titles> > </publishers> > <publishers> > <pub_id>1389</pub_id> > <pub_name>Algodata Infosystems</pub_name> > <city>Berkeley</city> > <state>CA</state> > <country>USA</country> > <titles> > <title_id>BU1032</title_id> > <title>The Busy Executive's Database Guide</title> > <type>business </type> > <pub_id>1389</pub_id> > <price>19.99</price> > <advance>5000</advance> > <royalty>10</royalty> > <ytd_sales>4095</ytd_sales> > <notes>An overview of available database systems with emphasis on common > business applications. Illustrated.</notes> > <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>BU1111</title_id> > <title>Cooking with Computers: Surreptitious Balance Sheets</title> > <type>business </type> > <pub_id>1389</pub_id> > <price>11.95</price> > <advance>5000</advance> > <royalty>10</royalty> > <ytd_sales>3876</ytd_sales> > <notes>Helpful hints on how to use your electronic resources to the best > advantage.</notes> > <pubdate>1991-06-09T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>BU7832</title_id> > <title>Straight Talk About Computers</title> > <type>business </type> > <pub_id>1389</pub_id> > <price>19.99</price> > <advance>5000</advance> > <royalty>10</royalty> > <ytd_sales>4095</ytd_sales> > <notes>Annotated analysis of what computers can do for you: a no-hype > guide for the critical user.</notes> > <pubdate>1991-06-22T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>PC1035</title_id> > <title>But Is It User Friendly?</title> > <type>popular_comp</type> > <pub_id>1389</pub_id> > <price>22.95</price> > <advance>7000</advance> > <royalty>16</royalty> > <ytd_sales>8780</ytd_sales> > <notes>A survey of software for the naive user, focusing on the > 'friendliness' of each.</notes> > <pubdate>1991-06-30T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>PC8888</title_id> > <title>Secrets of Silicon Valley</title> > <type>popular_comp</type> > <pub_id>1389</pub_id> > <price>20</price> > <advance>8000</advance> > <royalty>10</royalty> > <ytd_sales>4095</ytd_sales> > <notes>Muckraking reporting on the world's largest computer hardware and > software manufacturers.</notes> > <pubdate>1994-06-12T00:00:00.0000000-03:00</pubdate> > </titles> > <titles> > <title_id>PC9999</title_id> > <title>Net Etiquette</title> > <type>popular_comp</type> > <pub_id>1389</pub_id> > <notes>A must-read for computer conferencing.</notes> > <pubdate>2000-08-06T00:00:00.0000000-03:00</pubdate> > </titles> > </publishers> > <publishers> > <pub_id>1622</pub_id> > <pub_name>Five Lakes Publishing</pub_name> > <city>Chicago</city> > <state>IL</state> > <country>USA</country> > </publishers> > <publishers> > <pub_id>1756</pub_id> > <pub_name>Ramona Publishers</pub_name> > <city>Dallas</city> > <state>TX</state> > <country>USA</country> > </publishers> > <publishers> > <pub_id>9901</pub_id> > <pub_name>GGG&G</pub_name> > <city>M=FCnchen</city> > <country>Germany</country> > </publishers> > <publishers> > <pub_id>9952</pub_id> > <pub_name>Scootney Books</pub_name> > <city>New York</city> > <state>NY</state> > <country>USA</country> > </publishers> > <publishers> > <pub_id>9999</pub_id> > <pub_name>Lucerne Publishing</pub_name> > <city>Paris</city> > <country>France</country> > </publishers> > --- NEW FILE: Tests.cs --- > using System; > using System.IO; > using System.Xml; > > using Mvp.Xml.Common; > using NUnit.Framework; > > namespace Mvp.Xml.Tests.XmlFragments > { > [TestFixture] > public class Tests > { > [Test] > public void ReadFragments() > { > XmlDocument doc =3D new XmlDocument(); > doc.Load(new XmlTextReader(null, new XmlFragmentStream(Globals.GetResourc= e > ( > this.GetType().Namespace + ".publishers.xml")))); > > doc =3D new XmlDocument(); > XmlNamespaceManager mgr =3D new XmlNamespaceManager(doc.NameTable); > XmlTextReader tr =3D new XmlTextReader(Globals.GetResource( > this.GetType().Namespace + ".publishers.xml"), XmlNodeType.Element, > new XmlParserContext( doc.NameTable, mgr, null, XmlSpace.None)); > while (tr.Read()) > { > Console.Write(doc.OuterXml); > } > } > > [Test] > public void ReadFragmentsRoot() > { > XmlDocument doc =3D new XmlDocument(); > doc.Load(new XmlTextReader(new XmlFragmentStream(Globals.GetResource( > this.GetType().Namespace + ".publishers.xml"), "pubs"))); > Console.Write(doc.OuterXml); > } > > [Test] > public void ReadFragmentsRootNs() > { > XmlDocument doc =3D new XmlDocument(); > doc.Load(new XmlTextReader(new XmlFragmentStream(Globals.GetResource( > this.GetType().Namespace + ".publishers.xml"), "pubs", "mvp-xml"))); > Console.Write(doc.OuterXml); > } > } > } > > > > --__--__-- > > Message: 2 > From: Oleg Tkachenko <he...@us...> > To: mvp...@li... > Date: Tue, 25 Oct 2005 21:33:46 +0000 > Subject: [mvp-xml-cvs] Common/v2/test/UpperLowerTests Customer.cs,NONE,1.= 1 > Customer.xml,NONE,1.1 Customer.xsd,NONE,1.1 Customer.xsx,NONE,1.1 > FirstUpperLowerTests.cs,NONE,1.1 > > Update of /cvsroot/mvp-xml/Common/v2/test/UpperLowerTests > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/test/UpperLowerTests > > Added Files: > Customer.cs Customer.xml Customer.xsd Customer.xsx > FirstUpperLowerTests.cs > Log Message: > > > --- NEW FILE: Customer.xml --- > (This appears to be a binary file; contents omitted.) > > --- NEW FILE: Customer.xsx --- > <?xml version=3D"1.0" encoding=3D"utf-8"?> > <!--This file is auto-generated by the XML Schema Designer. It holds > layout information for components on the designer surface.--> > <XSDDesignerLayout layoutVersion=3D"2" viewPortLeft=3D"0" viewPortTop=3D"= 0" > zoom=3D"100"> > <customer_XmlElement left=3D"317" top=3D"254" width=3D"5292" height=3D"29= 63" > selected=3D"0" zOrder=3D"1" index=3D"0" expanded=3D"1"> > <order_XmlElement left=3D"317" top=3D"3725" width=3D"5292" height=3D"2963= " > selected=3D"0" zOrder=3D"2" index=3D"1" expanded=3D"1" /> > </customer_XmlElement> > </XSDDesignerLayout> > --- NEW FILE: Customer.xsd --- > <?xml version=3D"1.0" encoding=3D"utf-8" ?> > <xs:schema id=3D"Customer" targetNamespace=3D"mvp-xml-customer" > elementFormDefault=3D"qualified" > xmlns=3D"mvp-xml-customer" xmlns:mstns=3D"mvp-xml-customer" xmlns:xs=3D" > http://www.w3.org/2001/XMLSchema"> > <xs:element name=3D"Customer"> > <xs:complexType> > <xs:sequence> > <xs:element name=3D"Name" type=3D"xs:string" /> > <xs:element name=3D"Order"> > <xs:complexType> > <xs:attribute name=3D"Id" type=3D"xs:int" use=3D"required" /> > </xs:complexType> > </xs:element> > </xs:sequence> > <xs:attribute name=3D"Id" type=3D"xs:string" /> > </xs:complexType> > </xs:element> > </xs:schema> > --- NEW FILE: Customer.cs --- > namespace Mvp.Xml.Tests.UpperLowerTests > { > > > /// <remarks/> > [System.Xml.Serialization.XmlTypeAttribute(Namespace=3D"mvp-xml-customer"= )] > [System.Xml.Serialization.XmlRootAttribute(Namespace=3D"mvp-xml-customer"= , > IsNullable=3Dfalse)] > public class Customer > { > > /// <remarks/> > public string Name; > > /// <remarks/> > public CustomerOrder Order; > > /// <remarks/> > [System.Xml.Serialization.XmlAttributeAttribute()] > public string Id; > } > > /// <remarks/> > [System.Xml.Serialization.XmlTypeAttribute(Namespace=3D"mvp-xml-customer"= )] > public class CustomerOrder > { > > /// <remarks/> > [System.Xml.Serialization.XmlAttributeAttribute()] > public int Id; > } > } > > --- NEW FILE: FirstUpperLowerTests.cs --- > #region using > > using System; > using System.Diagnostics; > using System.IO; > using System.Reflection; > using System.Xml; > using System.Xml.Serialization; > using System.Xml.XPath; > using System.Xml.Schema; > > using Mvp.Xml.Common; > using NUnit.Framework; > > #endregion using > > namespace Mvp.Xml.Tests.UpperLowerTests > { > [TestFixture] > public class FirstUpperLowerTests > { > [Test] > public void XmlFirstUpperReader() > { > string xml =3D "<customer id=3D'1' pp:id=3D'aba' xmlns=3D'urn-kzu' > xmlns:pp=3D'urn-pepenamespace'><pp:order /><order > id=3D'1'>Chocolates</order></customer>"; > > XmlFirstUpperReader fr =3D new XmlFirstUpperReader(new StringReader(xml))= ; > > fr.MoveToContent(); > Assert.AreEqual("Customer", fr.LocalName); > fr.MoveToFirstAttribute(); > Assert.AreEqual("Id", fr.LocalName); > fr.MoveToNextAttribute(); > Assert.AreEqual("pp:Id", fr.Name); > > // Namespace ordering is not guaranteed. > fr.MoveToNextAttribute(); > Assert.IsTrue( fr.Name =3D=3D "xmlns" || fr.Name =3D=3D "xmlns:pp" ); > fr.MoveToNextAttribute(); > Assert.IsTrue( fr.Name =3D=3D "xmlns" || fr.Name =3D=3D "xmlns:pp" ); > > fr.MoveToElement(); > fr.Read(); > Assert.AreEqual("pp:Order", fr.Name); > } > > [Test] > public void XmlFirstLowerWriter() > { > string xml =3D "<Customer Id=3D\"1\" pp:Id=3D\"aba\" xmlns=3D\"urn-kzu\" > xmlns:pp=3D\"urn-pepenamespace\"><pp:Order /><Order > Id=3D\"1\">chocolates</Order></Customer>"; > > XmlTextReader tr =3D new XmlTextReader(new StringReader(xml)); > > StringWriter sw =3D new StringWriter(); > XmlFirstLowerWriter fw =3D new XmlFirstLowerWriter(sw); > > fw.WriteNode(tr, true); > fw.Flush(); > > Assert.AreEqual(xml.ToLower(), sw.ToString()); > } > > [Test] > public void Deserialization() > { > XmlFirstUpperReader fu =3D new XmlFirstUpperReader(Globals.GetResource( > this.GetType().Namespace + ".Customer.xml")); > XmlReaderSettings settings =3D new XmlReaderSettings(); > settings.ValidationType =3D ValidationType.Schema; > settings.Schemas.Add(XmlSchema.Read(Globals.GetResource( > this.GetType().Namespace + ".Customer.xsd"), null)); > XmlReader vr =3D XmlReader.Create(fu, settings); > XmlSerializer ser =3D new XmlSerializer(typeof(Customer)); > Customer c =3D (Customer) ser.Deserialize(vr); > > Assert.AreEqual("0736", c.Id); > Assert.AreEqual("Daniel Cazzulino", c.Name); > Assert.AreEqual(25, c.Order.Id <http://c.Order.Id>); > } > > [Test] > public void Serialization() > { > XmlFirstUpperReader fu =3D new XmlFirstUpperReader(Globals.GetResource( > this.GetType().Namespace + ".Customer.xml")); > XmlSerializer ser =3D new XmlSerializer(typeof(Customer)); > Customer c =3D (Customer) ser.Deserialize(fu); > > StringWriter sw =3D new StringWriter(); > XmlFirstLowerWriter fl =3D new XmlFirstLowerWriter(sw); > > ser.Serialize(fl, c); > > Assert.AreEqual("<?xml version=3D\"1.0\" encoding=3D\"utf-16\"?><customer > xmlns:xsd=3D\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=3D\" > http://www.w3.org/2001/XMLSchema-instance\" id=3D\"0736\" > xmlns=3D\"mvp-xml-customer\"><name>Daniel Cazzulino</name><order id=3D\"2= 5\" > /></customer>", > sw.ToString()); > } > } > } > > > > --__--__-- > > _______________________________________________ > mvp-xml-cvs mailing list > mvp...@li... > https://lists.sourceforge.net/lists/listinfo/mvp-xml-cvs > > > End of mvp-xml-cvs Digest > > -- Daniel Cazzulino [MVP XML] Clarius Consulting SA http://clariusconsulting.net/kzu "He who is good for making excuses, is seldom good for anything else." |
From: Oleg T. <he...@us...> - 2005-10-25 21:34:02
|
Update of /cvsroot/mvp-xml/Common/v2/test/UpperLowerTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/test/UpperLowerTests Added Files: Customer.cs Customer.xml Customer.xsd Customer.xsx FirstUpperLowerTests.cs Log Message: --- NEW FILE: Customer.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Customer.xsx --- <?xml version="1.0" encoding="utf-8"?> <!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.--> <XSDDesignerLayout layoutVersion="2" viewPortLeft="0" viewPortTop="0" zoom="100"> <customer_XmlElement left="317" top="254" width="5292" height="2963" selected="0" zOrder="1" index="0" expanded="1"> <order_XmlElement left="317" top="3725" width="5292" height="2963" selected="0" zOrder="2" index="1" expanded="1" /> </customer_XmlElement> </XSDDesignerLayout> --- NEW FILE: Customer.xsd --- <?xml version="1.0" encoding="utf-8" ?> <xs:schema id="Customer" targetNamespace="mvp-xml-customer" elementFormDefault="qualified" xmlns="mvp-xml-customer" xmlns:mstns="mvp-xml-customer" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Customer"> <xs:complexType> <xs:sequence> <xs:element name="Name" type="xs:string" /> <xs:element name="Order"> <xs:complexType> <xs:attribute name="Id" type="xs:int" use="required" /> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="Id" type="xs:string" /> </xs:complexType> </xs:element> </xs:schema> --- NEW FILE: Customer.cs --- namespace Mvp.Xml.Tests.UpperLowerTests { /// <remarks/> [System.Xml.Serialization.XmlTypeAttribute(Namespace="mvp-xml-customer")] [System.Xml.Serialization.XmlRootAttribute(Namespace="mvp-xml-customer", IsNullable=false)] public class Customer { /// <remarks/> public string Name; /// <remarks/> public CustomerOrder Order; /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string Id; } /// <remarks/> [System.Xml.Serialization.XmlTypeAttribute(Namespace="mvp-xml-customer")] public class CustomerOrder { /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public int Id; } } --- NEW FILE: FirstUpperLowerTests.cs --- #region using using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Xml; using System.Xml.Serialization; using System.Xml.XPath; using System.Xml.Schema; using Mvp.Xml.Common; using NUnit.Framework; #endregion using namespace Mvp.Xml.Tests.UpperLowerTests { [TestFixture] public class FirstUpperLowerTests { [Test] public void XmlFirstUpperReader() { string xml = "<customer id='1' pp:id='aba' xmlns='urn-kzu' xmlns:pp='urn-pepenamespace'><pp:order /><order id='1'>Chocolates</order></customer>"; XmlFirstUpperReader fr = new XmlFirstUpperReader(new StringReader(xml)); fr.MoveToContent(); Assert.AreEqual("Customer", fr.LocalName); fr.MoveToFirstAttribute(); Assert.AreEqual("Id", fr.LocalName); fr.MoveToNextAttribute(); Assert.AreEqual("pp:Id", fr.Name); // Namespace ordering is not guaranteed. fr.MoveToNextAttribute(); Assert.IsTrue( fr.Name == "xmlns" || fr.Name == "xmlns:pp" ); fr.MoveToNextAttribute(); Assert.IsTrue( fr.Name == "xmlns" || fr.Name == "xmlns:pp" ); fr.MoveToElement(); fr.Read(); Assert.AreEqual("pp:Order", fr.Name); } [Test] public void XmlFirstLowerWriter() { string xml = "<Customer Id=\"1\" pp:Id=\"aba\" xmlns=\"urn-kzu\" xmlns:pp=\"urn-pepenamespace\"><pp:Order /><Order Id=\"1\">chocolates</Order></Customer>"; XmlTextReader tr = new XmlTextReader(new StringReader(xml)); StringWriter sw = new StringWriter(); XmlFirstLowerWriter fw = new XmlFirstLowerWriter(sw); fw.WriteNode(tr, true); fw.Flush(); Assert.AreEqual(xml.ToLower(), sw.ToString()); } [Test] public void Deserialization() { XmlFirstUpperReader fu = new XmlFirstUpperReader(Globals.GetResource( this.GetType().Namespace + ".Customer.xml")); XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationType = ValidationType.Schema; settings.Schemas.Add(XmlSchema.Read(Globals.GetResource( this.GetType().Namespace + ".Customer.xsd"), null)); XmlReader vr = XmlReader.Create(fu, settings); XmlSerializer ser = new XmlSerializer(typeof(Customer)); Customer c = (Customer) ser.Deserialize(vr); Assert.AreEqual("0736", c.Id); Assert.AreEqual("Daniel Cazzulino", c.Name); Assert.AreEqual(25, c.Order.Id); } [Test] public void Serialization() { XmlFirstUpperReader fu = new XmlFirstUpperReader(Globals.GetResource( this.GetType().Namespace + ".Customer.xml")); XmlSerializer ser = new XmlSerializer(typeof(Customer)); Customer c = (Customer) ser.Deserialize(fu); StringWriter sw = new StringWriter(); XmlFirstLowerWriter fl = new XmlFirstLowerWriter(sw); ser.Serialize(fl, c); Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-16\"?><customer xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" id=\"0736\" xmlns=\"mvp-xml-customer\"><name>Daniel Cazzulino</name><order id=\"25\" /></customer>", sw.ToString()); } } } |
From: Oleg T. <he...@us...> - 2005-10-25 21:34:02
|
Update of /cvsroot/mvp-xml/Common/v2/test/XmlFragments In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/test/XmlFragments Added Files: Tests.cs publishers.xml Log Message: --- NEW FILE: publishers.xml --- <publishers> <pub_id>0736</pub_id> <pub_name>New Moon Books</pub_name> <city>Boston</city> <state>MA</state> <country>USA</country> <titles> <title_id>BU2075</title_id> <title>You Can Combat Computer Stress!</title> <type>business </type> <pub_id>0736</pub_id> <price>2.99</price> <advance>10125</advance> <royalty>24</royalty> <ytd_sales>18722</ytd_sales> <notes>The latest medical and psychological techniques for living with the electronic office. Easy-to-understand explanations.</notes> <pubdate>1991-06-30T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS2091</title_id> <title>Is Anger the Enemy?</title> <type>psychology </type> <pub_id>0736</pub_id> <price>10.95</price> <advance>2275</advance> <royalty>12</royalty> <ytd_sales>2045</ytd_sales> <notes>Carefully researched study of the effects of strong emotions on the body. Metabolic charts included.</notes> <pubdate>1991-06-15T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS2106</title_id> <title>Life Without Fear</title> <type>psychology </type> <pub_id>0736</pub_id> <price>7</price> <advance>6000</advance> <royalty>10</royalty> <ytd_sales>111</ytd_sales> <notes>New exercise, meditation, and nutritional techniques that can reduce the shock of daily interactions. Popular audience. Sample menus included, exercise video available separately.</notes> <pubdate>1991-10-05T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS3333</title_id> <title>Prolonged Data Deprivation: Four Case Studies</title> <type>psychology </type> <pub_id>0736</pub_id> <price>19.99</price> <advance>2000</advance> <royalty>10</royalty> <ytd_sales>4072</ytd_sales> <notes>What happens when the data runs dry? Searching evaluations of information-shortage effects.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS7777</title_id> <title>Emotional Security: A New Algorithm</title> <type>psychology </type> <pub_id>0736</pub_id> <price>7.99</price> <advance>4000</advance> <royalty>10</royalty> <ytd_sales>3336</ytd_sales> <notes>Protecting yourself and your loved ones from undue emotional stress in the modern world. Use of computer and nutritional aids emphasized.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> </publishers> <publishers> <pub_id>0877</pub_id> <pub_name>Binnet & Hardley</pub_name> <city>Washington</city> <state>DC</state> <country>USA</country> <titles> <title_id>MC2222</title_id> <title>Silicon Valley Gastronomic Treats</title> <type>mod_cook </type> <pub_id>0877</pub_id> <price>19.99</price> <advance>0</advance> <royalty>12</royalty> <ytd_sales>2032</ytd_sales> <notes>Favorite recipes for quick, easy, and elegant meals.</notes> <pubdate>1991-06-09T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>MC3021</title_id> <title>The Gourmet Microwave</title> <type>mod_cook </type> <pub_id>0877</pub_id> <price>2.99</price> <advance>15000</advance> <royalty>24</royalty> <ytd_sales>22246</ytd_sales> <notes>Traditional French gourmet recipes adapted for modern microwave cooking.</notes> <pubdate>1991-06-18T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>MC3026</title_id> <title>The Psychology of Computer Cooking</title> <type>UNDECIDED </type> <pub_id>0877</pub_id> <pubdate>2000-08-06T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS1372</title_id> <title>Computer Phobic AND Non-Phobic Individuals: Behavior Variations</title> <type>psychology </type> <pub_id>0877</pub_id> <price>21.59</price> <advance>7000</advance> <royalty>10</royalty> <ytd_sales>375</ytd_sales> <notes>A must for the specialist, this book examines the difference between those who hate and fear computers and those who don't.</notes> <pubdate>1991-10-21T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>TC3218</title_id> <title>Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean</title> <type>trad_cook </type> <pub_id>0877</pub_id> <price>20.95</price> <advance>7000</advance> <royalty>10</royalty> <ytd_sales>375</ytd_sales> <notes>Profusely illustrated in color, this makes a wonderful gift book for a cuisine-oriented friend.</notes> <pubdate>1991-10-21T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>TC4203</title_id> <title>Fifty Years in Buckingham Palace Kitchens</title> <type>trad_cook </type> <pub_id>0877</pub_id> <price>11.95</price> <advance>4000</advance> <royalty>14</royalty> <ytd_sales>15096</ytd_sales> <notes>More anecdotes from the Queen's favorite cook describing life among English royalty. Recipes, techniques, tender vignettes.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>TC7777</title_id> <title>Sushi, Anyone?</title> <type>trad_cook </type> <pub_id>0877</pub_id> <price>14.99</price> <advance>8000</advance> <royalty>10</royalty> <ytd_sales>4095</ytd_sales> <notes>Detailed instructions on how to make authentic Japanese sushi in your spare time.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> </publishers> <publishers> <pub_id>1389</pub_id> <pub_name>Algodata Infosystems</pub_name> <city>Berkeley</city> <state>CA</state> <country>USA</country> <titles> <title_id>BU1032</title_id> <title>The Busy Executive's Database Guide</title> <type>business </type> <pub_id>1389</pub_id> <price>19.99</price> <advance>5000</advance> <royalty>10</royalty> <ytd_sales>4095</ytd_sales> <notes>An overview of available database systems with emphasis on common business applications. Illustrated.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>BU1111</title_id> <title>Cooking with Computers: Surreptitious Balance Sheets</title> <type>business </type> <pub_id>1389</pub_id> <price>11.95</price> <advance>5000</advance> <royalty>10</royalty> <ytd_sales>3876</ytd_sales> <notes>Helpful hints on how to use your electronic resources to the best advantage.</notes> <pubdate>1991-06-09T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>BU7832</title_id> <title>Straight Talk About Computers</title> <type>business </type> <pub_id>1389</pub_id> <price>19.99</price> <advance>5000</advance> <royalty>10</royalty> <ytd_sales>4095</ytd_sales> <notes>Annotated analysis of what computers can do for you: a no-hype guide for the critical user.</notes> <pubdate>1991-06-22T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PC1035</title_id> <title>But Is It User Friendly?</title> <type>popular_comp</type> <pub_id>1389</pub_id> <price>22.95</price> <advance>7000</advance> <royalty>16</royalty> <ytd_sales>8780</ytd_sales> <notes>A survey of software for the naive user, focusing on the 'friendliness' of each.</notes> <pubdate>1991-06-30T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PC8888</title_id> <title>Secrets of Silicon Valley</title> <type>popular_comp</type> <pub_id>1389</pub_id> <price>20</price> <advance>8000</advance> <royalty>10</royalty> <ytd_sales>4095</ytd_sales> <notes>Muckraking reporting on the world's largest computer hardware and software manufacturers.</notes> <pubdate>1994-06-12T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PC9999</title_id> <title>Net Etiquette</title> <type>popular_comp</type> <pub_id>1389</pub_id> <notes>A must-read for computer conferencing.</notes> <pubdate>2000-08-06T00:00:00.0000000-03:00</pubdate> </titles> </publishers> <publishers> <pub_id>1622</pub_id> <pub_name>Five Lakes Publishing</pub_name> <city>Chicago</city> <state>IL</state> <country>USA</country> </publishers> <publishers> <pub_id>1756</pub_id> <pub_name>Ramona Publishers</pub_name> <city>Dallas</city> <state>TX</state> <country>USA</country> </publishers> <publishers> <pub_id>9901</pub_id> <pub_name>GGG&G</pub_name> <city>München</city> <country>Germany</country> </publishers> <publishers> <pub_id>9952</pub_id> <pub_name>Scootney Books</pub_name> <city>New York</city> <state>NY</state> <country>USA</country> </publishers> <publishers> <pub_id>9999</pub_id> <pub_name>Lucerne Publishing</pub_name> <city>Paris</city> <country>France</country> </publishers> --- NEW FILE: Tests.cs --- using System; using System.IO; using System.Xml; using Mvp.Xml.Common; using NUnit.Framework; namespace Mvp.Xml.Tests.XmlFragments { [TestFixture] public class Tests { [Test] public void ReadFragments() { XmlDocument doc = new XmlDocument(); doc.Load(new XmlTextReader(null, new XmlFragmentStream(Globals.GetResource( this.GetType().Namespace + ".publishers.xml")))); doc = new XmlDocument(); XmlNamespaceManager mgr = new XmlNamespaceManager(doc.NameTable); XmlTextReader tr = new XmlTextReader(Globals.GetResource( this.GetType().Namespace + ".publishers.xml"), XmlNodeType.Element, new XmlParserContext( doc.NameTable, mgr, null, XmlSpace.None)); while (tr.Read()) { Console.Write(doc.OuterXml); } } [Test] public void ReadFragmentsRoot() { XmlDocument doc = new XmlDocument(); doc.Load(new XmlTextReader(new XmlFragmentStream(Globals.GetResource( this.GetType().Namespace + ".publishers.xml"), "pubs"))); Console.Write(doc.OuterXml); } [Test] public void ReadFragmentsRootNs() { XmlDocument doc = new XmlDocument(); doc.Load(new XmlTextReader(new XmlFragmentStream(Globals.GetResource( this.GetType().Namespace + ".publishers.xml"), "pubs", "mvp-xml"))); Console.Write(doc.OuterXml); } } } |
From: Oleg T. <he...@us...> - 2005-10-25 21:34:02
|
Update of /cvsroot/mvp-xml/Common/v2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/src Modified Files: Common.csproj XmlBaseAwareXmlTextReader.cs XmlNamespaces.cs XmlNodeListFactory.cs Added Files: XmlFragmentStream.cs XmlNodeFactory.cs Log Message: --- NEW FILE: XmlNodeFactory.cs --- #region using using System; using System.Xml; using System.Xml.Serialization; using System.Xml.XPath; using Mvp.Xml.Common.XPath; #endregion namespace Mvp.Xml.Common { /// <summary> /// Creates <see cref="XmlNode"/> wrapper instances /// for different XML APIs, for use in XML serialization. /// </summary> /// <remarks> /// <see cref="XmlNode"/> instances returned by this factory only /// support the <see cref="XmlNode.WriteTo"/> and <see cref="XmlNode.WriteContentTo"/> /// methods, as they are intended for use only for serialization, and to avoid /// <see cref="XmlDocument"/> loading for fast performance. All other members /// will throw an <see cref="NotSupportedException"/>. /// <para>Author: Daniel Cazzulino, kz...@gm...</para> /// See: http://weblogs.asp.net/cazzu/archive/2004/05/31/144922.aspx and /// http://weblogs.asp.net/cazzu/posts/XmlMessagePerformance.aspx. /// </remarks> public class XmlNodeFactory { private XmlNodeFactory() {} #region Create overloads /// <summary> /// Creates an <see cref="XmlNode"/> wrapper for any object, /// to be serialized through the <see cref="XmlSerializer"/>. /// </summary> /// <param name="value">The object to wrap.</param> /// <returns>A node that can only be used for XML serialization.</returns> public static XmlNode Create(object value) { return new ObjectNode(value); } /// <summary> /// Creates an <see cref="XmlNode"/> serializable /// wrapper for an <see cref="XPathNavigator"/>. /// </summary> /// <param name="navigator">The navigator to wrap.</param> /// <returns>A node that can only be used for XML serialization.</returns> public static XmlNode Create(XPathNavigator navigator) { return new XPathNavigatorNode(navigator); } /// <summary> /// Creates an <see cref="XmlNode"/> serializable /// wrapper for an <see cref="XmlReader"/>. /// </summary> /// <param name="reader">The reader to wrap.</param> /// <returns>A node that can only be used for XML serialization.</returns> /// <remarks> /// After serialization, the reader is automatically closed. /// </remarks> public static XmlNode Create(XmlReader reader) { return Create(reader, false); } /// <summary> /// Creates an <see cref="XmlDocument"/> serializable /// wrapper for an <see cref="XPathNavigator"/>. /// </summary> /// <param name="reader">The reader to wrap.</param> /// <param name="defaultAttrs">Whether default attributes should be serialized.</param> /// <returns>A document that can only be used for XML serialization.</returns> /// <remarks> /// After serialization, the reader is automatically closed. /// </remarks> public static XmlNode Create(XmlReader reader, bool defaultAttrs) { return new XmlReaderNode(reader, defaultAttrs); } #endregion Create overloads #region SerializableNode private abstract class SerializableNode : XmlElement { public SerializableNode() : base("", "dummy", "", new XmlDocument()) {} public override XmlNode AppendChild(XmlNode newChild) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override XmlAttributeCollection Attributes { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string BaseURI { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlNodeList ChildNodes { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlNode Clone() { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override XmlNode CloneNode(bool deep) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override XmlNode FirstChild { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string GetNamespaceOfPrefix(string prefix) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override string GetPrefixOfNamespace(string namespaceURI) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override bool HasChildNodes { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string InnerText { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } set { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string InnerXml { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } set { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlNode InsertAfter(XmlNode newChild, XmlNode refChild) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override XmlNode InsertBefore(XmlNode newChild, XmlNode refChild) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override bool IsReadOnly { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlNode LastChild { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string LocalName { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string Name { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string NamespaceURI { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlNode NextSibling { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlNodeType NodeType { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override void Normalize() { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override string OuterXml { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlDocument OwnerDocument { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlNode ParentNode { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string Prefix { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } set { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlNode PrependChild(XmlNode newChild) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override XmlNode PreviousSibling { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override void RemoveAll() { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override XmlNode RemoveChild(XmlNode oldChild) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override XmlNode ReplaceChild(XmlNode newChild, XmlNode oldChild) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override bool Supports(string feature, string version) { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } public override XmlElement this[string localname, string ns] { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override XmlElement this[string name] { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override string Value { get { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } set { throw new NotSupportedException(SR.XmlDocumentFactory_NotImplementedDOM); } } public override void WriteContentTo(XmlWriter w) { WriteTo(w); } public abstract override void WriteTo(XmlWriter w); } #endregion SerializableNode #region XPathNavigatorNode private class XPathNavigatorNode : SerializableNode { private XPathNavigator _navigator; public XPathNavigatorNode() {} public XPathNavigatorNode(XPathNavigator navigator) { _navigator = navigator; } public override void WriteTo(XmlWriter w) { w.WriteNode(_navigator.ReadSubtree(), false); } } #endregion XPathNavigatorNode #region XmlReaderNode private class XmlReaderNode : SerializableNode { private XmlReader _reader; private bool _default; public XmlReaderNode() {} public XmlReaderNode(XmlReader reader, bool defaultAttrs) { _reader = reader; _reader.MoveToContent(); _default = defaultAttrs; } public override void WriteTo(XmlWriter w) { w.WriteNode(_reader, _default); _reader.Close(); } } #endregion XmlReaderNode #region ObjectNode private class ObjectNode : SerializableNode { private object serializableObject; public ObjectNode() {} public ObjectNode(object serializableObject) { this.serializableObject = serializableObject; } public override void WriteTo(XmlWriter w) { XmlSerializer ser = new XmlSerializer(serializableObject.GetType()); ser.Serialize(w, serializableObject); } } #endregion XmlReaderNode } } Index: XmlNodeListFactory.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XmlNodeListFactory.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- XmlNodeListFactory.cs 16 Oct 2005 16:51:24 -0000 1.1 +++ XmlNodeListFactory.cs 25 Oct 2005 21:33:43 -0000 1.2 @@ -2,6 +2,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Xml; using System.Xml.XPath; @@ -9,176 +10,178 @@ 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> + /// 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> + /// <para>Contributors: Oleg Tkachenko, ol...@xm...</para> + /// </remarks> + public sealed class XmlNodeListFactory + { + private XmlNodeListFactory() {} - /// <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); - } + #region Public members - #endregion 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); + } - #region XmlNodeListIterator + #endregion Public members - private class XmlNodeListIterator : XmlNodeList - { - XPathNodeIterator _iterator; - ArrayList _nodes = new ArrayList(); + #region XmlNodeListIterator - public XmlNodeListIterator(XPathNodeIterator iterator) - { - _iterator = iterator.Clone(); - } + private class XmlNodeListIterator: XmlNodeList + { + XPathNodeIterator _iterator; + IList<XmlNode> _nodes = new List<XmlNode>(); - public override IEnumerator GetEnumerator() - { - return new XmlNodeListEnumerator(this); - } + public XmlNodeListIterator(XPathNodeIterator iterator) + { + _iterator = iterator.Clone(); + } - 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 IEnumerator GetEnumerator() + { + return new XmlNodeListEnumerator(this); + } + + public override XmlNode Item(int index) + { - public override int Count - { - get - { - if (!_done) ReadToEnd(); - return _nodes.Count; - } - } + if (index >= _nodes.Count) + ReadTo(index); + // Compatible behavior with .NET + if (index >= _nodes.Count || index < 0) + return null; + return _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 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> + /// 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> + /// 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; } - } + /// <summary> + /// Current count of nodes in the iterator (read so far). + /// </summary> + private int CurrentPosition + { + get { return _nodes.Count; } + } - #region XmlNodeListEnumerator + #region XmlNodeListEnumerator - private class XmlNodeListEnumerator : IEnumerator - { - XmlNodeListIterator _iterator; - int _position = -1; + private class XmlNodeListEnumerator: IEnumerator + { + XmlNodeListIterator _iterator; + int _position = -1; - public XmlNodeListEnumerator(XmlNodeListIterator iterator) - { - _iterator = iterator; - } + public XmlNodeListEnumerator(XmlNodeListIterator iterator) + { + _iterator = iterator; + } - #region IEnumerator Members + #region IEnumerator Members - void System.Collections.IEnumerator.Reset() - { - _position = -1; - } + void System.Collections.IEnumerator.Reset() + { + _position = -1; + } - bool System.Collections.IEnumerator.MoveNext() - { - _position++; - _iterator.ReadTo(_position); + 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; + // 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; - } + return true; + } - object System.Collections.IEnumerator.Current - { - get - { - return _iterator[_position]; - } - } + object System.Collections.IEnumerator.Current + { + get + { + return _iterator[_position]; + } + } - #endregion - } + #endregion + } - #endregion XmlNodeListEnumerator - } + #endregion XmlNodeListEnumerator + } - #endregion XmlNodeListIterator - } + #endregion XmlNodeListIterator + } } --- NEW FILE: XmlFragmentStream.cs --- #region using using System; using System.IO; using System.Text; #endregion using namespace Mvp.Xml.Common { /// <summary> /// Allows streams without a root element (i.e. multiple document /// fragments) to be passed to an <see cref="System.Xml.XmlReader"/>. /// </summary> /// <remarks>A faked root element is added at the stream /// level to enclose the fragments, which can be customized /// using the overloaded constructors. /// <para>Author: Daniel Cazzulino, kz...@gm...</para> /// See: http://weblogs.asp.net/cazzu/archive/2004/04/23/119263.aspx. /// </remarks> public class XmlFragmentStream : Stream { #region Fields // Holds the inner stream with the XML fragments. Stream _stream; bool _first = true; bool _done = false; bool _eof = false; // TODO: there's a potential encoding issue here. byte[] _rootstart = UTF8Encoding.UTF8.GetBytes("<root>"); byte[] _rootend = UTF8Encoding.UTF8.GetBytes("</root>"); int _endidx = -1; #endregion Fields #region Ctors /// <summary> /// Initializes the class with the underlying stream to use, and /// uses the default <root> container element. /// </summary> /// <param name="innerStream">The stream to read from.</param> public XmlFragmentStream(Stream innerStream) { if (innerStream == null) throw new ArgumentNullException("innerStream"); _stream = innerStream; } /// <summary> /// Initializes the class with the underlying stream to use, with /// a custom root element. /// </summary> /// <param name="innerStream">The stream to read from.</param> /// <param name="rootName">Custom root element name to use.</param> public XmlFragmentStream(Stream innerStream, string rootName) : this (innerStream) { _rootstart = UTF8Encoding.UTF8.GetBytes("<" + rootName + ">"); _rootend = UTF8Encoding.UTF8.GetBytes("</" + rootName + ">"); } /// <summary> /// Initializes the class with the underlying stream to use, with /// a custom root element. /// </summary> /// <param name="innerStream">The stream to read from.</param> /// <param name="rootName">Custom root element name to use.</param> /// <param name="ns">The namespace of the root element.</param> public XmlFragmentStream(Stream innerStream, string rootName, string ns) : this (innerStream) { _rootstart = UTF8Encoding.UTF8.GetBytes("<" + rootName + " xmlns=\"" + ns + "\">"); _rootend = UTF8Encoding.UTF8.GetBytes("</" + rootName + ">"); } #endregion Ctors #region Stream abstract implementation /// <summary>See <see cref="Stream.Flush"/>.</summary> public override void Flush() { _stream.Flush(); } /// <summary>See <see cref="Stream.Seek"/>.</summary> public override long Seek(long offset, SeekOrigin origin) { return _stream.Seek(offset, origin); } /// <summary>See <see cref="Stream.SetLength"/>.</summary> public override void SetLength(long value) { _stream.SetLength(value); } /// <summary>See <see cref="Stream.Write"/>.</summary> public override void Write(byte[] buffer, int offset, int count) { _stream.Write(buffer, offset, count); } /// <summary>See <see cref="Stream.CanRead"/>.</summary> public override bool CanRead { get { return _stream.CanRead; } } /// <summary>See <see cref="Stream.CanSeek"/>.</summary> public override bool CanSeek { get { return _stream.CanSeek; } } /// <summary>See <see cref="Stream.CanWrite"/>.</summary> public override bool CanWrite { get { return _stream.CanWrite; } } /// <summary>See <see cref="Stream.Length"/>.</summary> public override long Length { get { return _stream.Length; } } /// <summary>See <see cref="Stream.Position"/>.</summary> public override long Position { get { return _stream.Position; } set { _stream.Position = value; } } #endregion Stream abstract implementation #region Read method /// <summary>See <see cref="Stream.Read"/>.</summary> public override int Read(byte[] buffer, int offset, int count) { if (_done) { if(!_eof) { _eof = true; return 0; } else { throw new System.IO.EndOfStreamException(SR.GetString(SR.XmlFragmentStream_EOF)); } } // If this is the first one, return the wrapper root element. if (_first) { _rootstart.CopyTo(buffer, 0); _stream.Read(buffer, _rootstart.Length, count - _rootstart.Length); _first = false; return count; } // We have a pending closing wrapper root element. if (_endidx != -1) { for (int i = _endidx; i < _rootend.Length; i++) { buffer[i] = _rootend[i]; } return _rootend.Length - _endidx; } int ret = _stream.Read(buffer, offset, count); // Did we reached the end? if (ret < count) { _rootend.CopyTo(buffer, ret); if (count - ret > _rootend.Length) { _done = true; return ret + _rootend.Length; } else { _endidx = count - ret; return count; } } return ret; } #endregion Read method } } Index: Common.csproj =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/Common.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Common.csproj 24 Oct 2005 12:08:27 -0000 1.3 +++ Common.csproj 25 Oct 2005 21:33:43 -0000 1.4 @@ -97,9 +97,11 @@ <Compile Include="XmlFirstUpperReader.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="XmlFragmentStream.cs" /> <Compile Include="XmlNamespaces.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="XmlNodeFactory.cs" /> <Compile Include="XmlNodeListFactory.cs"> <SubType>Code</SubType> </Compile> @@ -109,6 +111,7 @@ <Compile Include="XPath\DynamicContext.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="XPath\IHasXPathNavigator.cs" /> <Compile Include="XPath\IndexingXPathNavigator.cs"> <SubType>Code</SubType> </Compile> Index: XmlBaseAwareXmlTextReader.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XmlBaseAwareXmlTextReader.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- XmlBaseAwareXmlTextReader.cs 24 Oct 2005 12:08:27 -0000 1.2 +++ XmlBaseAwareXmlTextReader.cs 25 Oct 2005 21:33:43 -0000 1.3 @@ -9,28 +9,28 @@ namespace Mvp.Xml.Common { - /// <summary> - /// XmlTextReader supporting <a href="http://www.w3.org/TR/xmlbase/">XML Base</a>. - /// </summary> - /// <remarks> - /// <para>Author: Oleg Tkachenko, ol...@xm...</para> - /// </remarks> - public class XmlBaseAwareXmlTextReader : XmlTextReader + /// <summary> + /// XmlTextReader supporting <a href="http://www.w3.org/TR/xmlbase/">XML Base</a>. + /// </summary> + /// <remarks> + /// <para>Author: Oleg Tkachenko, ol...@xm...</para> + /// </remarks> + public class XmlBaseAwareXmlTextReader : XmlTextReader { #region private private XmlBaseState _state = new XmlBaseState(); private Stack<XmlBaseState> _states = null; - #endregion + #endregion #region constructors - + /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given URI. /// </summary> public XmlBaseAwareXmlTextReader(string uri) - : base(uri) + : base(uri) { _state.BaseUri = new Uri(base.BaseURI); } @@ -40,7 +40,7 @@ /// name table. /// </summary> public XmlBaseAwareXmlTextReader(string uri, XmlNameTable nt) - : base(uri, nt) + : base(uri, nt) { _state.BaseUri = new Uri(base.BaseURI); } @@ -49,14 +49,14 @@ /// Creates XmlBaseAwareXmlTextReader instance for given TextReader. /// </summary> public XmlBaseAwareXmlTextReader(TextReader reader) - : base(reader) {} + : base(reader) { } /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given uri and /// TextReader. /// </summary> public XmlBaseAwareXmlTextReader(string uri, TextReader reader) - : base(uri, reader) + : base(uri, reader) { _state.BaseUri = new Uri(base.BaseURI); } @@ -66,14 +66,14 @@ /// and name table. /// </summary> public XmlBaseAwareXmlTextReader(TextReader reader, XmlNameTable nt) - : base(reader, 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) + : base(uri, reader, nt) { _state.BaseUri = new Uri(base.BaseURI); } @@ -82,13 +82,13 @@ /// Creates XmlBaseAwareXmlTextReader instance for given stream. /// </summary> public XmlBaseAwareXmlTextReader(Stream stream) - : base(stream) {} + : base(stream) { } /// <summary> /// Creates XmlBaseAwareXmlTextReader instance for given uri and stream. /// </summary> public XmlBaseAwareXmlTextReader(string uri, Stream stream) - : base(uri, stream) + : base(uri, stream) { _state.BaseUri = new Uri(base.BaseURI); } @@ -98,14 +98,14 @@ /// and name table. /// </summary> public XmlBaseAwareXmlTextReader(Stream stream, XmlNameTable nt) - : base(stream, 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) + : base(uri, stream, nt) { _state.BaseUri = new Uri(base.BaseURI); } @@ -121,7 +121,7 @@ { get { - return _state.BaseUri==null? "" : _state.BaseUri.AbsoluteUri; + return _state.BaseUri == null ? "" : _state.BaseUri.AbsoluteUri; } } @@ -129,47 +129,47 @@ /// See <see cref="XmlTextReader.Read"/>. /// </summary> public override bool Read() - { + { bool baseRead = base.Read(); - if (baseRead) + if (baseRead) { if (base.NodeType == XmlNodeType.Element && - base.HasAttributes) + base.HasAttributes) { string baseAttr = GetAttribute("xml:base"); if (baseAttr == null) - return baseRead; + return baseRead; Uri newBaseUri = null; if (_state.BaseUri == null) - newBaseUri = new Uri(baseAttr); + newBaseUri = new Uri(baseAttr); else - newBaseUri = new Uri(_state.BaseUri, baseAttr); + newBaseUri = new Uri(_state.BaseUri, baseAttr); if (_states == null) _states = new Stack<XmlBaseState>(); //Push current state and allocate new one - _states.Push(_state); + _states.Push(_state); _state = new XmlBaseState(newBaseUri, base.Depth); } - else if (base.NodeType == XmlNodeType.EndElement) + else if (base.NodeType == XmlNodeType.EndElement) { - if (base.Depth == _state.Depth && _states != null && _states.Count > 0) + if (base.Depth == _state.Depth && _states != null && _states.Count > 0) { //Pop previous state _state = _states.Pop(); } } } - return baseRead; + return baseRead; } #endregion } - internal class XmlBaseState + internal class XmlBaseState { - public XmlBaseState() {} + public XmlBaseState() { } - public XmlBaseState(Uri baseUri, int depth) + public XmlBaseState(Uri baseUri, int depth) { this.BaseUri = baseUri; this.Depth = depth; Index: XmlNamespaces.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XmlNamespaces.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- XmlNamespaces.cs 16 Oct 2005 16:51:24 -0000 1.1 +++ XmlNamespaces.cs 25 Oct 2005 21:33:43 -0000 1.2 @@ -10,13 +10,8 @@ /// 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 + public static class XmlNamespaces + { #region Public Constants |
From: Oleg T. <he...@us...> - 2005-10-25 21:33:55
|
Update of /cvsroot/mvp-xml/Common/v2/test/SubtreeeXPathNavigatorTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/test/SubtreeeXPathNavigatorTests Added Files: Tests.cs nodecopy.xsl print_root.xsl test.xsl Log Message: --- NEW FILE: Tests.cs --- #region using using System; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using System.IO; using System.Diagnostics; using Mvp.Xml.Common.XPath; using NUnit.Framework; #endregion namespace Mvp.Xml.Tests.SubtreeeXPathNavigatorTests { [TestFixture] public class SubtreeTests { [Test] public void SubtreeSpeed() { XPathDocument xdoc = new XPathDocument(Globals.GetResource(Globals.LibraryResource)); XPathNavigator nav = xdoc.CreateNavigator(); XmlDocument doc = new XmlDocument(); doc.Load(Globals.GetResource(Globals.LibraryResource)); XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load(new XmlTextReader( Globals.GetResource(this.GetType().Namespace + ".print_root.xsl"))); Stopwatch stopWatch = new Stopwatch(); // Warmup MemoryStream stmdom = new MemoryStream(); XmlDocument wd = new XmlDocument(); wd.LoadXml(doc.DocumentElement.FirstChild.OuterXml); xslt.Transform(wd, null, stmdom); MemoryStream stmxpath = new MemoryStream(); nav.MoveToRoot(); nav.MoveToFirstChild(); nav.MoveToFirstChild(); xslt.Transform(new SubtreeXPathNavigator(nav), null, stmxpath); nav = doc.CreateNavigator(); int count = 10; float dom = 0; float xpath = 0; for (int i = 0; i < count; i++) { GC.Collect(); System.Threading.Thread.Sleep(1000); stmdom = new MemoryStream(); stopWatch.Start(); // Create a new document for each child foreach (XmlNode testNode in doc.DocumentElement.ChildNodes) { XmlDocument tmpDoc = new XmlDocument(); tmpDoc.LoadXml(testNode.OuterXml); // Transform the subset. xslt.Transform(tmpDoc, null, stmdom); } stopWatch.Stop(); dom += stopWatch.ElapsedMilliseconds; GC.Collect(); System.Threading.Thread.Sleep(1000); stmxpath = new MemoryStream(); XPathExpression expr = nav.Compile("/library/book"); stopWatch.Start(); XPathNodeIterator books = nav.Select(expr); while (books.MoveNext()) { xslt.Transform(new SubtreeXPathNavigator(books.Current), null, stmxpath); } stopWatch.Stop(); xpath += stopWatch.ElapsedMilliseconds; } Console.WriteLine("XmlDocument transformation: {0}", dom / count); Console.WriteLine("SubtreeXPathNavigator transformation: {0}", xpath / count); stmdom.Position = 0; stmxpath.Position = 0; Console.WriteLine(new StreamReader(stmdom).ReadToEnd()); Console.WriteLine(new string('*', 100)); Console.WriteLine(new string('*', 100)); Console.WriteLine(new StreamReader(stmxpath).ReadToEnd()); } [Test] public void SubtreeTransform() { XslCompiledTransform tx = new XslCompiledTransform(); tx.Load(new XmlTextReader( Globals.GetResource(this.GetType().Namespace + ".test.xsl"))); string xml = @" <root> <salutations> <salute>Hi there <name>kzu</name>.</salute> <salute>Bye there <name>vga</name>.</salute> </salutations> <other> Hi there without salutations. </other> </root>"; XmlDocument dom = new XmlDocument(); dom.LoadXml(xml); tx.Transform(new DebuggingXPathNavigator(dom.DocumentElement.FirstChild.CreateNavigator()), null, Console.Out); Console.WriteLine(); XPathDocument doc = new XPathDocument(new StringReader(xml)); XPathNavigator nav = doc.CreateNavigator(); nav.MoveToRoot(); nav.MoveToFirstChild(); // Salutations. nav.MoveToFirstChild(); tx.Transform(new DebuggingXPathNavigator(new SubtreeXPathNavigator(nav)), null, Console.Out); } [Test] public void TestBooks() { XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load(new XmlTextReader( Globals.GetResource(this.GetType().Namespace + ".nodecopy.xsl"))); XPathDocument doc = new XPathDocument(Globals.GetResource(Globals.LibraryResource)); XmlDocument dom = new XmlDocument(); dom.Load(Globals.GetResource(Globals.LibraryResource)); xslt.Transform(dom.DocumentElement.FirstChild.CreateNavigator(), null, Console.Out); Console.WriteLine(); //Navigator over first child of document element XPathNavigator nav = doc.CreateNavigator(); nav.MoveToRoot(); nav.MoveToFirstChild(); nav.MoveToFirstChild(); xslt.Transform(new SubtreeXPathNavigator(nav), null, Console.Out); } [Test] public void TestRead() { XPathDocument doc = new XPathDocument(Globals.GetResource(Globals.LibraryResource)); //Navigator over first child of document element XPathNavigator nav = doc.CreateNavigator(); nav.MoveToRoot(); nav.MoveToFirstChild(); nav.MoveToFirstChild(); Console.WriteLine(nav.OuterXml); } } } --- NEW FILE: nodecopy.xsl --- <stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" > <output indent="yes"/> <template match="/"> <copy-of select="." /> </template> </stylesheet> --- NEW FILE: print_root.xsl --- <?xml version="1.0" encoding="UTF-8" ?> <stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" > <output method="text" /> <template match="/"> Root node is <value-of select="local-name(//*[position() = 1])" /> </template> </stylesheet> --- NEW FILE: test.xsl --- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:template match="/"> <!-- <xsl:copy-of select="." /> --> <xsl:apply-templates select="//name" /> <!-- <xsl:apply-templates /> --> </xsl:template> <xsl:template match="name"> <person><xsl:value-of select="." /></person> Out of scope ancestor: <xsl:copy-of select="../../../../*[1]" /><xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet> |
Update of /cvsroot/mvp-xml/Common/v2/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/src/XPath Modified Files: DynamicContext.cs IHasXPathNavigator.cs IndexingXPathNavigator.cs SubtreeeXPathNavigator.cs XPathCache.cs XPathIteratorReader.cs XPathNavigatorIterator.cs Log Message: Index: DynamicContext.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/DynamicContext.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- DynamicContext.cs 19 Oct 2005 14:46:30 -0000 1.1 +++ DynamicContext.cs 25 Oct 2005 21:33:44 -0000 1.2 @@ -25,7 +25,8 @@ { #region Private vars - IDictionary<string, DynamicVariable> _variables = new Dictionary<string, DynamicVariable>(); + IDictionary<string, IXsltContextVariable> _variables = + new Dictionary<string, IXsltContextVariable>(); #endregion Private @@ -84,7 +85,7 @@ #region Common Overrides /// <summary> - /// Implementation equal to <see cref="XsltContext.CompareDocument(string, string)"/>. + /// Implementation equal to <see cref="XsltContext"/>. /// </summary> public override int CompareDocument(string baseUri, string nextbaseUri) { @@ -116,7 +117,7 @@ } /// <summary> - /// Same as <see cref="XsltContext.PreserveWhitespace(XPathNavigator)"/>. + /// Same as <see cref="XsltContext"/>. /// </summary> public override bool PreserveWhitespace(XPathNavigator node) { @@ -124,7 +125,7 @@ } /// <summary> - /// Same as <see cref="XsltContext.Whitespace"/>. + /// Same as <see cref="XsltContext"/>. /// </summary> public override bool Whitespace { @@ -209,7 +210,7 @@ /// </summary> public override IXsltContextVariable ResolveVariable(string prefix, string name) { - return _variables[name] as IXsltContextVariable; + return _variables[name]; } #endregion Variable Handling Code Index: XPathIteratorReader.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/XPathIteratorReader.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- XPathIteratorReader.cs 19 Oct 2005 14:46:30 -0000 1.1 +++ XPathIteratorReader.cs 25 Oct 2005 21:33:44 -0000 1.2 @@ -1,8 +1,7 @@ #region using using System; -using System.Collections; -using System.Collections.Specialized; +using System.Collections.Generic; using System.IO; using System.Xml; using System.Xml.Serialization; @@ -142,8 +141,8 @@ { get { return _current.IsEmptyElement; } } - - /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> + + /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> public override string this[string name, string ns] { get { return _current[name, ns]; } @@ -261,8 +260,8 @@ { return _current.LookupNamespace(prefix); } - - /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> + + /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> public override bool MoveToAttribute(string name, string ns) { return _current.MoveToAttribute(name, ns); @@ -318,7 +317,7 @@ if (read) { // Just move to the next node and create the reader. - _current = _iterator.Current.ReadSubtree(); + _current = _iterator.Current.ReadSubtree(); return _current.Read(); } else @@ -465,7 +464,7 @@ get { return false; } } - /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> + /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> public override string this[string name, string ns] { get { return null; } @@ -477,7 +476,7 @@ get { return null; } } - /// <summary>See <see cref="XmlReader.this[string]"/></summary> + /// <summary>See <see cref="XmlReader.this[int]"/></summary> public override string this[int i] { get { return null; } @@ -558,8 +557,8 @@ { _state = ReadState.Closed; } - - /// <summary>See <see cref="XmlReader.GetAttribute(string, string)"/></summary> + + /// <summary>See <see cref="XmlReader.GetAttribute(string, string)"/></summary> public override string GetAttribute(string name, string ns) { return null; @@ -582,8 +581,8 @@ { return null; } - - /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> + + /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> public override bool MoveToAttribute(string name, string ns) { return false; Index: IndexingXPathNavigator.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/IndexingXPathNavigator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IndexingXPathNavigator.cs 19 Oct 2005 14:46:30 -0000 1.1 +++ IndexingXPathNavigator.cs 25 Oct 2005 21:33:44 -0000 1.2 @@ -18,8 +18,9 @@ /// and not searhing the tree. This allows drastically decrease selection time /// on preindexed selections. /// </summary> - /// <remarks>Author: Oleg Tkachenko, ol...@tk... - /// Contributors: Daniel Cazzulino, kz...@gm... + /// <remarks> + /// <para>Author: Oleg Tkachenko, ol...@xm...</para> + /// <para>Contributors: Daniel Cazzulino, kz...@gm...</para> /// <para>See http://www.tkachenko.com/blog/archives/000194.html</para> /// </remarks> public class IndexingXPathNavigator : XPathNavigator @@ -246,7 +247,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToFirstNamespace(XPathNamespaceScope)"/>. + /// See <see cref="XPathNavigator.MoveToFirstNamespace(XPathNamespaceScope)"/>. /// </summary> public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope) { @@ -254,7 +255,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToNextNamespace(XPathNamespaceScope)"/>. + /// See <see cref="XPathNavigator.MoveToNextNamespace(XPathNamespaceScope)"/>. /// </summary> public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope) { @@ -585,20 +586,16 @@ /// </summary> private class XPathNavigatorIndex { - private IList<KeyDef> keys; - private IDictionary<string, List<XPathNavigator>> index; - private Type arrayIteratorType; + private List<KeyDef> keys; + private IDictionary<string, List<XPathNavigator>> index; /// <summary> /// Creates index over specified XPathNavigator. /// </summary> public XPathNavigatorIndex() { - keys = new List<KeyDef>(); - index = new Dictionary<string, List<XPathNavigator>>(); - Assembly systemXml = typeof(XPathNodeIterator).Assembly; - // TODO: is there another way? - arrayIteratorType = systemXml.GetType("System.Xml.XPath.XPathArrayIterator"); + keys = new List<KeyDef>(); + index = new Dictionary<string, List<XPathNavigator>>(); } /// <summary> @@ -630,13 +627,12 @@ XPathNodeIterator nodes = keyValue as XPathNodeIterator; while (nodes.MoveNext()) { - IList<XPathNavigator> chunkOfIndexedNodes = index[nodes.Current.Value]; - if (chunkOfIndexedNodes != null) - { - if (indexedNodes == null) - indexedNodes = new List<XPathNavigator>(); - indexedNodes.AddRange(chunkOfIndexedNodes); - } + if (index.ContainsKey(nodes.Current.Value)) + { + if (indexedNodes == null) + indexedNodes = new List<XPathNavigator>(); + indexedNodes.AddRange(index[nodes.Current.Value]); + } } } else @@ -644,11 +640,9 @@ indexedNodes = index[keyValue.ToString()]; } if (indexedNodes == null) - indexedNodes = new List<XPathNavigator>(0); + indexedNodes = new List<XPathNavigator>(0); - return (XPathNodeIterator) Activator.CreateInstance( arrayIteratorType, - BindingFlags.Instance | BindingFlags.Public | - BindingFlags.CreateInstance, null, new object[]{indexedNodes}, null ); + return new XPathNavigatorIterator(indexedNodes); } /// <summary> @@ -691,12 +685,16 @@ private void AddNodeToIndex(XPathNavigator node, string key) { //Get slot - List<XPathNavigator> indexedNodes = index[key]; - if (indexedNodes == null) - { - indexedNodes = new List<XPathNavigator>(); - index.Add(key, indexedNodes); - } + List<XPathNavigator> indexedNodes; + if (index.ContainsKey(key)) + { + indexedNodes = index[key]; + } + else + { + indexedNodes = new List<XPathNavigator>(); + index.Add(key, indexedNodes); + } indexedNodes.Add(node.Clone()); } } @@ -726,13 +724,17 @@ this.nav = nav; //Named indexes are stored in a hashtable. if (indexes == null) - indexes = new Dictionary<string, XPathNavigatorIndex>(); - XPathNavigatorIndex index = indexes[indexName]; - if (index == null) - { - index = new XPathNavigatorIndex(); + indexes = new Dictionary<string, XPathNavigatorIndex>(); + XPathNavigatorIndex index; + if (indexes.ContainsKey(indexName)) + { + index = indexes[indexName]; + } + else + { + index = new XPathNavigatorIndex(); indexes.Add(indexName, index); - } + } index.AddKey(key); } Index: IHasXPathNavigator.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/IHasXPathNavigator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IHasXPathNavigator.cs 19 Oct 2005 14:46:30 -0000 1.1 +++ IHasXPathNavigator.cs 25 Oct 2005 21:33:44 -0000 1.2 @@ -9,6 +9,9 @@ /// <summary> /// Enables a class to return an XPathNavigator from the current context or position. /// </summary> + /// <remarks> + /// <para>Author: Oleg Tkachenko, ol...@xm...</para> + /// </remarks> public interface IHasXPathNavigator { /// <summary> Index: XPathCache.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/XPathCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- XPathCache.cs 19 Oct 2005 14:46:30 -0000 1.1 +++ XPathCache.cs 25 Oct 2005 21:33:44 -0000 1.2 @@ -2,6 +2,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Xml; using System.Xml.XPath; @@ -32,17 +33,17 @@ /// Initially a simple hashtable. In the future should /// implement sliding expiration of unused expressions. /// </summary> - private static IDictionary Cache + private static IDictionary<string, XPathExpression> Cache { get { return _cache; } - } static IDictionary _cache = new Hashtable(); + } static IDictionary<string, XPathExpression> _cache = new Dictionary<string, XPathExpression>(); /// <summary> /// Retrieves a cached compiled expression, or a newly compiled one. /// </summary> private static XPathExpression GetCompiledExpression(string expression, XPathNavigator source) { - XPathExpression expr = (XPathExpression) Cache[expression]; + XPathExpression expr = Cache[expression]; // No double checks. At most we will compile twice. No big deal. if (expr == null) @@ -333,7 +334,7 @@ /// Selects a node set using the specified XPath expression and sort. /// </summary> /// <remarks> - /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. + /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. /// </remarks> public static XPathNodeIterator SelectSorted(string expression, XPathNavigator source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType ) @@ -531,7 +532,7 @@ /// Selects a node set using the specified XPath expression and sort. /// </summary> /// <remarks> - /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. + /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. /// </remarks> public static XmlNodeList SelectNodesSorted(string expression, XmlNode source, object sortExpression, IComparer comparer) @@ -543,8 +544,8 @@ /// <summary> /// Selects a node set using the specified XPath expression and sort. /// </summary> - /// <remarks> - /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. + /// <remarks>(object, IComparer) + /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. /// </remarks> public static XmlNodeList SelectNodesSorted(string expression, XmlNode source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType ) Index: SubtreeeXPathNavigator.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/SubtreeeXPathNavigator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SubtreeeXPathNavigator.cs 19 Oct 2005 14:46:30 -0000 1.1 +++ SubtreeeXPathNavigator.cs 25 Oct 2005 21:33:44 -0000 1.2 @@ -1,11 +1,8 @@ #region using using System; -using System.Collections; using System.Xml; using System.Xml.XPath; -using System.Xml.Xsl; -using System.Reflection; #endregion using @@ -19,7 +16,7 @@ /// <remarks>Author: Daniel Cazzulino, kz...@gm... /// <para>See http://weblogs.asp.net/cazzu/archive/2004/06/24/164243.aspx</para> /// </remarks> - public class SubtreeeXPathNavigator : XPathNavigator + public class SubtreeXPathNavigator : XPathNavigator { #region Fields & Ctors @@ -33,18 +30,18 @@ bool _fragment; /// <summary> - /// Creates SubtreeeXPathNavigator over specified XPathNavigator. + /// Creates SubtreeXPathNavigator over specified XPathNavigator. /// </summary> /// <param name="navigator">Navigator that determines scope.</param> /// <remarks>The incoming navigator is cloned upon construction, /// which isolates the calling code from movements to the - /// <see cref="SubtreeeXPathNavigator"/>.</remarks> - public SubtreeeXPathNavigator(XPathNavigator navigator) : this(navigator, false) + /// <see cref="SubtreeXPathNavigator"/>.</remarks> + public SubtreeXPathNavigator(XPathNavigator navigator) : this(navigator, false) { } /// <summary> - /// Creates SubtreeeXPathNavigator over specified XPathNavigator. + /// Creates SubtreeXPathNavigator over specified XPathNavigator. /// </summary> /// <param name="navigator">Navigator that determines scope.</param> /// <param name="enableFragment">Whether the navigator should be able to @@ -52,15 +49,15 @@ /// scope.</param> /// <remarks>The incoming navigator is cloned upon construction, /// which isolates the calling code from movements to the - /// <see cref="SubtreeeXPathNavigator"/>.</remarks> - public SubtreeeXPathNavigator(XPathNavigator navigator, bool enableFragment) + /// <see cref="SubtreeXPathNavigator"/>.</remarks> + public SubtreeXPathNavigator(XPathNavigator navigator, bool enableFragment) { _navigator = navigator.Clone(); _root = navigator.Clone(); _fragment = enableFragment; } - private SubtreeeXPathNavigator(XPathNavigator root, XPathNavigator current, + private SubtreeXPathNavigator(XPathNavigator root, XPathNavigator current, bool atRoot, bool enableFragment) { _root = root.Clone(); @@ -196,12 +193,12 @@ #region Methods /// <summary> - /// Creates new cloned version of the <see cref="SubtreeeXPathNavigator"/>. + /// Creates new cloned version of the <see cref="SubtreeXPathNavigator"/>. /// </summary> - /// <returns>Cloned copy of the <see cref="SubtreeeXPathNavigator"/>.</returns> + /// <returns>Cloned copy of the <see cref="SubtreeXPathNavigator"/>.</returns> public override XPathNavigator Clone() { - return new SubtreeeXPathNavigator(_root, _navigator, _atroot, _fragment); + return new SubtreeXPathNavigator(_root, _navigator, _atroot, _fragment); } /// <summary> @@ -209,10 +206,10 @@ /// </summary> public override bool IsSamePosition(XPathNavigator other) { - if (other == null || !(other is SubtreeeXPathNavigator)) + if (other == null || !(other is SubtreeXPathNavigator)) return false; - SubtreeeXPathNavigator nav = (SubtreeeXPathNavigator) other; + SubtreeXPathNavigator nav = (SubtreeXPathNavigator) other; return nav._atroot == this._atroot && nav._navigator.IsSamePosition(this._navigator) && nav._root.IsSamePosition(this._root); @@ -233,10 +230,10 @@ /// </summary> public override bool MoveTo(XPathNavigator other) { - if (other == null || !(other is SubtreeeXPathNavigator)) + if (other == null || !(other is SubtreeXPathNavigator)) return false; - return _navigator.MoveTo(((SubtreeeXPathNavigator)other)._navigator); + return _navigator.MoveTo(((SubtreeXPathNavigator)other)._navigator); } /// <summary> @@ -401,7 +398,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToFirstNamespace(XPathNamespaceScope)"/>. + /// See <see cref="XPathNavigator.MoveToFirstNamespace(XPathNamespaceScope)"/>. /// </summary> public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope) { @@ -409,7 +406,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToNextNamespace(XPathNamespaceScope)"/>. + /// See <see cref="XPathNavigator.MoveToNextNamespace(XPathNamespaceScope)"/>. /// </summary> public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope) { Index: XPathNavigatorIterator.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XPath/XPathNavigatorIterator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- XPathNavigatorIterator.cs 19 Oct 2005 14:46:30 -0000 1.1 +++ XPathNavigatorIterator.cs 25 Oct 2005 21:33:44 -0000 1.2 @@ -9,16 +9,15 @@ namespace Mvp.Xml.Common.XPath { /// <summary> - /// An <see cref="XPathNodeIterator"/> over a collection of - /// <see cref="XPathItem"/> items. Also allows - /// arbitrary addition/removal of the <see cref="XPathItem"/> - /// items that belong to the set. + /// An <see cref="XPathNodeIterator"/> that allows + /// arbitrary addition of the <see cref="XPathNavigator"/> + /// nodes that belong to the set. /// </summary> public class XPathNavigatorIterator : XPathNodeIterator { #region Fields & Ctors - private List<XPathNavigator> _navigators; + private List<XPathNavigator> _navigators; private int _position = -1; /// <summary> @@ -26,82 +25,34 @@ /// </summary> public XPathNavigatorIterator() { - _navigators = new List<XPathNavigator>(); + _navigators = new List<XPathNavigator>(); } - /// <summary> - /// Initializes a new instance of the <see cref="XPathNavigatorIterator"/>. - /// </summary> - public XPathNavigatorIterator(int capacity) - { - _navigators = new List<XPathNavigator>(capacity); - } + /// <summary> + /// Initializes a new instance of the <see cref="XPathNavigatorIterator"/> + /// with given initial capacity. + /// </summary> + public XPathNavigatorIterator(int capacity) + { + _navigators = new List<XPathNavigator>(capacity); + } /// <summary> /// Initializes a new instance of the <see cref="XPathNavigatorIterator"/>, /// using the received navigator as the initial item in the set. /// </summary> public XPathNavigatorIterator(XPathNavigator navigator) - : this() { + : this() { _navigators.Add(navigator); - } - - /// <summary> - /// Initializes a new instance of the <see cref="XPathNavigatorIterator"/>, - /// using the received navigators as the initial set. - /// </summary> - public XPathNavigatorIterator(XPathNodeIterator navigators) - : this() { - foreach (XPathNavigator nav in navigators) - { - _navigators.Add(nav); - } - } - - /// <summary> - /// Initializes a new instance of the <see cref="XPathNavigatorIterator"/>, - /// using the received navigators as the initial set. - /// </summary> - /// <param name="removeDuplicates">A flag that indicates whether duplicate nodes - /// should be loaded into the nodelist or only node with unique identity should - /// be added</param> - - public XPathNavigatorIterator(XPathNodeIterator navigators, bool removeDuplicates) - : this() - { - XPathNodeIterator it = navigators.Clone(); - - while (it.MoveNext()) - { - if (removeDuplicates) - { - if (_navigators.Contains(it.Current)) - { - continue; - } - } - _navigators.Add(it.Current.Clone()); - } - - } - - /// <summary> - /// Initializes a new instance of the <see cref="XPathNavigatorIterator"/>, - /// using the received navigators as the initial set. - /// </summary> - public XPathNavigatorIterator(XPathNavigator[] navigators) - : this() - { - _navigators.AddRange(navigators); - } + } /// <summary> - /// Initializes a new instance of the <see cref="XPathNavigatorIterator"/>, - /// using the received navigators as the initial set. + /// Initializes a new instance of the <see cref="XPathNavigatorIterator"/> + /// using given list of navigators. /// </summary> - private XPathNavigatorIterator(IEnumerable<XPathNavigator> navigators) + public XPathNavigatorIterator(List<XPathNavigator> navigators) { - _navigators = new List<XPathNavigator>(navigators); + _navigators = navigators; } #endregion Fields & Ctors @@ -119,7 +70,7 @@ SR.XPathNavigatorIterator_CantAddAfterMove); _navigators.Add(navigator.Clone()); - } + } /// <summary> /// Adds a <see cref="XPathNodeIterator"/> containing a set of navigators to add. @@ -137,87 +88,21 @@ } } - /// <summary> - /// Adds a collection of <see cref="XPathNavigator"/> nodes to the set. - /// </summary> - /// <param name="navigators">The set of navigators to add. Each one is cloned automatically.</param> - public void Add(IEnumerable<XPathNavigator> navigators) - { - if (_position != -1) - throw new InvalidOperationException( - SR.XPathNavigatorIterator_CantAddAfterMove); - - foreach (XPathNavigator nav in navigators) - { - _navigators.Add(nav.Clone()); - } - } - - /// <summary> - /// Gets or sets the element at the specified index - /// </summary> - public XPathNavigator this[int index] - { - get { return _navigators[index]; } - set { _navigators[index] = value; } - } - - /// <summary> - /// Determines whether the list contains a navigator positioned at the same - /// location as the specified XPathNavigator. This - /// method relies on the IsSamePositon() method of the XPathNavightor. - /// </summary> - /// <param name="value">The object to locate in the list.</param> - /// <returns>true if the object is found in the list; otherwise, false.</returns> - public bool Contains(XPathNavigator value) - { - foreach (XPathNavigator nav in _navigators) - { - if (nav.IsSamePosition(value)) + /// <summary> + /// Adds a <see cref="IEnumerable<XPathNavigator>"/> containing a set of navigators to add. + /// </summary> + /// <param name="navigators">The set of navigators to add. Each one is cloned automatically.</param> + public void Add(IEnumerable<XPathNavigator> navigators) { - return true; - } - } - return false; - } - - /// <summary> - /// Removes all items from the list. - /// </summary> - public void Clear() - { - _navigators.Clear(); - } - - - /// <summary> - /// Removes the list item at the specified index. - /// </summary> - /// <param name="index">The zero-based index of the item to remove.</param> - public void RemoveAt(int index) - { - _navigators.RemoveAt(index); - } - - /// <summary> - /// Determines whether the list contains a navigator whose Value property matches - /// the target value - /// </summary> - /// <param name="value">The value to locate in the list.</param> - /// <returns>true if the value is found in the list; otherwise, false.</returns> - public bool ContainsValue(string value) - { + if (_position != -1) + throw new InvalidOperationException( + SR.XPathNavigatorIterator_CantAddAfterMove); - foreach (XPathNavigator nav in _navigators) - { - if (nav.Value.Equals(value)) - { - return true; + foreach (XPathNavigator navigator in navigators) + { + _navigators.Add(navigator.Clone()); + } } - } - return false; - } - /// <summary> /// Resets the iterator. @@ -236,7 +121,8 @@ /// </summary> public override XPathNodeIterator Clone() { - return new XPathNavigatorIterator(_navigators); + return new XPathNavigatorIterator( + new List<XPathNavigator>(_navigators)); } /// <summary> |
From: Oleg T. <he...@us...> - 2005-10-25 21:33:54
|
Update of /cvsroot/mvp-xml/Common/v2/test/XPathIteratorReaderTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/test/XPathIteratorReaderTests Added Files: Tests.cs rss.xml Log Message: --- NEW FILE: Tests.cs --- using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Xml; using System.Xml.Serialization; using System.Xml.XPath; using System.Xml.Schema; using NUnit.Framework; using Mvp.Xml.Common.XPath; namespace Mvp.Xml.Tests.XPathIteratorReaderTests { [TestFixture] public class Tests { [Test] public void TestRss() { string theWord = "XML"; XPathDocument doc = new XPathDocument(Globals.GetResource( this.GetType().Namespace + ".rss.xml")); XPathNodeIterator it = doc.CreateNavigator().Select( "/rss/channel/item[contains(title,'" + theWord + "')]"); XPathIteratorReader reader = new XPathIteratorReader(it); reader.MoveToContent(); string xml = reader.ReadOuterXml(); using (StreamWriter sw = new StreamWriter(@"c:\subset.xml", false)) { XmlTextWriter tw = new XmlTextWriter(sw); tw.WriteNode(new XPathIteratorReader(it), false); tw.Close(); } Assert.IsTrue(xml != String.Empty); } [Test] public void Test1() { XPathDocument doc = new XPathDocument(Globals.GetResource(Globals.PubsResource)); XPathNodeIterator it = doc.CreateNavigator().Select("//price[text() < 5]"); XPathIteratorReader reader = new XPathIteratorReader(it, "prices"); reader.MoveToContent(); string xml = reader.ReadOuterXml(); Assert.IsTrue(xml != String.Empty); } [Test] public void FunctionalTest() { XPathDocument doc = new XPathDocument(new StringReader( "<customer xmlns='mvp-xml'><order id='1'/><order id='2'/><order id='5'/></customer>")); XPathNavigator nav = doc.CreateNavigator(); XmlNamespaceManager mgr = new XmlNamespaceManager(nav.NameTable); mgr.AddNamespace("mvp", "mvp-xml"); // On purpose, the query is wrong because it doesn't use the prefix. XPathExpression expr = nav.Compile("//order[@id < 3]"); expr.SetContext(mgr); XPathNodeIterator it = nav. Select(expr); XPathIteratorReader reader = new XPathIteratorReader(it, "orders"); reader.MoveToContent(); string xml = reader.ReadOuterXml(); Assert.AreEqual("<orders></orders>", xml); // With the right query now. expr = nav.Compile("//mvp:order[@id < 3]"); expr.SetContext(mgr); it = nav.Select(expr); reader = new XPathIteratorReader(it, "orders"); reader.MoveToContent(); xml = reader.ReadOuterXml(); Assert.AreEqual("<orders><order id=\"1\" xmlns=\"mvp-xml\" /><order id=\"2\" xmlns=\"mvp-xml\" /></orders>", xml); } } } --- NEW FILE: rss.xml --- <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>XML</title><link>http://weblogs.asp.net/cazzu/category/1567.aspx</link><description>XML</description><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.111</generator><item><dc:creator>Daniel Cazzulino</dc:creator><title>Mvp.Xml project: healthy start</title><link>http://weblogs.asp.net/cazzu/archive/2004/04/25/119940.aspx</link><pubDate>Sun, 25 Apr 2004 19:01:00 GMT</pubDate><guid>http://weblogs.asp.net/cazzu/archive/2004/04/25/119940.aspx</guid><wfw:comment>http://weblogs.asp.net/cazzu/comments/119940.aspx</wfw:comment><comments>http://weblogs.asp.net/cazzu/archive/2004/04/25/119940.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/cazzu/comments/commentRss/119940.aspx</wfw:commentRss><trackback:ping>http://weblogs.asp.net/cazzu/services/trackbacks/119940.aspx</trackback:ping><description>I've just checked the stats of our <a href="http://sourceforge.net/projects/mvp-xml">Mvp.Xml</a> project. Pretty good news for a project born only two months ago: <p> Page views: 1.421<br/> Downloads: 243<br/> Last 30 days we've had a steady rate of increase in page views of 200% a day, and 150% in downloads.</p><img src ="http://weblogs.asp.net/cazzu/aggbug/119940.aspx" width = "1" height = "1" /></description></item><item><dc:creator>Daniel Cazzulino</dc:creator><title>Reading XML fragments with XmlTextReader</title><link>http://weblogs.asp.net/cazzu/archive/2004/04/23/119263.aspx</link><pubDate>Fri, 23 Apr 2004 21:51:00 GMT</pubDate><guid>http://weblogs.asp.net/cazzu/archive/2004/04/23/119263.aspx</guid><wfw:comment>http://weblogs.asp.net/cazzu/comments/119263.aspx</wfw:comment><comments>http://weblogs.asp.net/cazzu/archive/2004/04/23/119263.aspx#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://weblogs.asp.net/cazzu/comments/commentRss/119263.aspx</wfw:commentRss><trackback:ping>http://weblogs.asp.net/cazzu/services/trackbacks/119263.aspx</trackback:ping><description> <p>Back at the <a href="http://mvp.support.microsoft.com/default.aspx?scid=fh;en-us;mvpsmt2004"> 2004 MVP Global Summit</a>, I met fellow XML fan <a href="http://weblogs.asp.net/kaevans"> Kirk</a>, who was seeking a solution to the following problem: you have a (several) megabytes file containing multiple XML fragments, and you want to read it (in <a href="http://weblogs.asp.net/kaevans/archive/2004/04/24/119508.aspx">his case</a> specially through the <a href="http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B90FDDCE-E60D-43F8-A5C4-C3BD760564BC">SgmlReader</a>). The problem is, of course, that the <code>XmlTextReader</code> will throw an exception as soon as it finds the second fragment, unless you use the special ctor. overload that takes an <code>XmlParsingContext</code>.<a href="http://www.25hoursaday.com/"> Dare</a> <a href="http://msdn.microsoft.com/xml/default.aspx?pull=/library/en-us/dnxmlnet/html/largexml.asp"> shows</a> an alternate solution based on XML inclusion techniques, either DTD external entities or <a href="http://workspaces.gotdotnet.com/xinclude">XInclude</a>. </p> <P>These techniques effectively expose a fully well-formed document to your application, which has a number of benefits, including the ability to transform it if you need to, for example. But I was thinking more along the lines of providing a class that could actually read the fragments without resorting to those mechanisms. I couldn't cheat the <code>XmlTextReader</code>, so I decided to go one step lower. The result is the <code>XmlFragmentStream</code>, a class that wraps any <code>System.IO.Stream</code> and fakes the missing root element, so that an <code>XmlTextReader</code> layered on top of it, will think [...2270 lines suppressed...] } } /// <summary> /// Advances the iteration cursor. /// </summary> /// <returns>True if more nodes remain in the iterator.</returns> bool IEnumerator.MoveNext() { return _iterator.MoveNext(); } #endregion } #endregion }</xmp> </div> <p><strong>Update: check an even better approach <a href="http://weblogs.asp.net/cazzu/archive/2004/04/14/113479.aspx">here</a>.</strong></p> <p>Enjoy!</p><img src ="http://weblogs.asp.net/cazzu/aggbug/86609.aspx" width = "1" height = "1" /></description></item></channel></rss> |
Update of /cvsroot/mvp-xml/Common/v2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/test Added Files: .cvsignore AssemblyInfo.cs CommonTest.csproj DebugUtils.cs DebuggingXPathNavigator.cs DebuggingXmlTextReader.cs Globals.cs IndexingXPathNavigatorTest.cs Misc.cs XPathCacheTests.cs XPathCacheUsability.cs XPathSortBug.cs XmlNodeFactoryTests.cs XmlNodeListFactoryTests.cs changelog.txt library.xml northwind.xml pubs.xml pubsNs.cs pubsNs.xml pubsNs.xsd Log Message: --- NEW FILE: CommonTest.csproj --- (This appears to be a binary file; contents omitted.) --- NEW FILE: .cvsignore --- bin obj *.user *.suo --- NEW FILE: DebugUtils.cs --- using System; using System.Xml; using System.Xml.XPath; namespace Mvp.Xml.Tests { /// <summary> /// Miscelaneous debug utilities. /// </summary> public class DebugUtils { private DebugUtils() {} public static void XPathNodeIteratorToConsole(XPathNodeIterator iterator) { Console.WriteLine(new string('-', 50)); XmlTextWriter tw = new XmlTextWriter(Console.Out); tw.Formatting = Formatting.Indented; while (iterator.MoveNext()) { tw.WriteNode(iterator.Current.ReadSubtree(), false); } tw.Flush(); Console.WriteLine(); Console.WriteLine(new string('-', 50)); } } } --- NEW FILE: Globals.cs --- using System; using System.IO; namespace Mvp.Xml.Tests { /// <summary> /// Loads test documents. /// </summary> public sealed class Globals { public const string MvpNamespace = "mvp-xml"; public const string MvpPrefix = "mvp"; /// <summary> /// The resource name for sample data from a library (<see cref="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconXslTransformClassImplementsXSLTProcessor.asp?frame=true&hidetoc=true"/>. /// </summary> public const string LibraryResource = "Mvp.Xml.Tests.library.xml"; /// <summary> /// The resource name for sample data from Pubs database. /// </summary> public const string PubsResource = "Mvp.Xml.Tests.pubs.xml"; /// <summary> /// The resource name for sample data from Pubs database with xmlns="mvp-xml". /// </summary> public const string PubsNsResource = "Mvp.Xml.Tests.pubsNs.xml"; /// <summary> /// The resource name for schema for the resource <see cref="PubsNsResource"/>. /// </summary> public const string PubsNsSchemaResource = "Mvp.Xml.Tests.pubsNs.xsd"; /// <summary> /// The resource name for sample data from Pubs database. /// </summary> public const string NorthwindResource = "Mvp.Xml.Tests.northwind.xml"; public static Stream GetResource(string name) { return typeof(Globals).Assembly.GetManifestResourceStream( name); } } } --- NEW FILE: pubsNs.xsd --- <?xml version="1.0" ?> <xs:schema xmlns:tns="mvp-xml" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="mvp-xml" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="dsPubs"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="publishers"> <xs:complexType> <xs:sequence> <xs:element name="pub_id" type="xs:unsignedShort" /> <xs:element name="pub_name" type="xs:string" /> <xs:element name="city" type="xs:string" /> <xs:element minOccurs="0" name="state" type="xs:string" /> <xs:element name="country" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="unbounded" name="titles"> <xs:complexType> <xs:sequence> <xs:element name="title_id" type="xs:string" /> <xs:element name="title" type="xs:string" /> <xs:element name="type" type="xs:string" /> <xs:element name="pub_id" type="xs:unsignedShort" /> <xs:element minOccurs="0" name="price" type="xs:decimal" /> <xs:element minOccurs="0" name="advance" type="xs:unsignedShort" /> <xs:element minOccurs="0" name="royalty" type="xs:unsignedByte" /> <xs:element minOccurs="0" name="ytd_sales" type="xs:unsignedShort" /> <xs:element minOccurs="0" name="notes" type="xs:string" /> <xs:element name="pubdate" type="xs:dateTime" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="id" type="xs:string" /> </xs:complexType> </xs:element> </xs:schema> --- NEW FILE: changelog.txt --- --------------------------------------------------------- April 01, 2004 Initial setup. Folder should preferably contain NUnit tests. --- NEW FILE: XmlNodeListFactoryTests.cs --- #region using using System; using System.Collections; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Xml.XPath; using NUnit.Framework; using Mvp.Xml.Common; #endregion using namespace Mvp.Xml.Tests { /// <summary> /// </summary> [TestFixture] public class XmlNodeListFactoryTests { private XmlDocument pubsDocument; [SetUp] public void Setup() { pubsDocument = new XmlDocument(); pubsDocument.Load(Globals.GetResource(Globals.PubsResource)); } [Test] public void MultipleCompleteEnumerations() { XPathNodeIterator nodeIterator = pubsDocument.CreateNavigator().Select("/dsPubs/publishers"); XmlNodeList nodeList = XmlNodeListFactory.CreateNodeList(nodeIterator); // Get the first node list enumerator. IEnumerator enumerator = nodeList.GetEnumerator(); while (enumerator.MoveNext()) { // Enumerate all publishers. } // Get the second node list enumerator. enumerator = nodeList.GetEnumerator(); // Ensure that the second node list enumerator is in a usable state. Assert.IsTrue(enumerator.MoveNext()); } [Test] public void List1() { string xml = @"<?xml version='1.0'?> <root> <element>1</element> <element></element> <element/> <element>2</element> </root>"; XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XPathNodeIterator iterator = doc.CreateNavigator().Select("//element"); XmlNodeList list = XmlNodeListFactory.CreateNodeList(iterator); int count = 0; foreach (XmlNode n in list) { count++; } Assert.AreEqual(4, count); iterator = doc.CreateNavigator().Select("//element"); list = XmlNodeListFactory.CreateNodeList(iterator); Assert.AreEqual(4, list.Count); } } } --- NEW FILE: DebuggingXPathNavigator.cs --- using System; using System.Xml; using System.Xml.XPath; namespace Mvp.Xml.Tests { /// <summary> /// Allows tracking of what members of the /// <see cref="XPathNavigator"/> class are being called. /// </summary> public sealed class DebuggingXPathNavigator : XPathNavigator { XPathNavigator _navigator; public DebuggingXPathNavigator(XPathNavigator navigator) { _navigator = navigator; } #region XPathNavigator overrides #region Properties /// <summary> /// See <see cref="XPathNavigator.BaseURI"/>. /// </summary> public override String BaseURI { get { System.Diagnostics.Debug.WriteLine("BaseURI = " + _navigator.BaseURI); return _navigator.BaseURI; } } /// <summary> /// See <see cref="XPathNavigator.HasAttributes"/>. /// </summary> public override bool HasAttributes { get { System.Diagnostics.Debug.WriteLine("HasAttributes = " + _navigator.HasAttributes); return _navigator.HasAttributes; } } /// <summary> /// See <see cref="XPathNavigator.HasChildren"/>. /// </summary> public override bool HasChildren { get { System.Diagnostics.Debug.WriteLine("HasAttributes = " + _navigator.HasChildren); return _navigator.HasChildren; } } /// <summary> /// See <see cref="XPathNavigator.IsEmptyElement"/>. /// </summary> public override bool IsEmptyElement { get { System.Diagnostics.Debug.WriteLine("IsEmptyElement = " + _navigator.IsEmptyElement); return _navigator.IsEmptyElement; } } /// <summary> /// See <see cref="XPathNavigator.LocalName"/>. /// </summary> public override string LocalName { get { System.Diagnostics.Debug.WriteLine("LocalName = " + _navigator.LocalName); return _navigator.LocalName; } } /// <summary> /// See <see cref="XPathNavigator.Name"/>. /// </summary> public override string Name { get { System.Diagnostics.Debug.WriteLine("Name = " + _navigator.Name); return _navigator.Name; } } /// <summary> /// See <see cref="XPathNavigator.NamespaceURI"/>. /// </summary> public override string NamespaceURI { get { System.Diagnostics.Debug.WriteLine("NamespaceURI = " + _navigator.NamespaceURI); return _navigator.NamespaceURI; } } /// <summary> /// See <see cref="XPathNavigator.NameTable"/>. /// </summary> public override XmlNameTable NameTable { get { System.Diagnostics.Debug.WriteLine("NameTable = " + _navigator.NameTable); return _navigator.NameTable; } } /// <summary> /// See <see cref="XPathNavigator.NodeType"/>. /// </summary> public override XPathNodeType NodeType { get { System.Diagnostics.Debug.WriteLine("NodeType = " + _navigator.NodeType); return _navigator.NodeType; } } /// <summary> /// See <see cref="XPathNavigator.Prefix"/>. /// </summary> public override string Prefix { get { System.Diagnostics.Debug.WriteLine("Prefix = " + _navigator.Prefix); return _navigator.Prefix; } } /// <summary> /// See <see cref="XPathNavigator.Value"/>. /// </summary> public override string Value { get { System.Diagnostics.Debug.WriteLine("Value = " + _navigator.Value); return _navigator.Value; } } /// <summary> /// See <see cref="XPathNavigator.XmlLang"/>. /// </summary> public override string XmlLang { get { System.Diagnostics.Debug.WriteLine("XmlLang = " + _navigator.XmlLang); return _navigator.XmlLang; } } #endregion Properties #region Methods /// <summary> /// Creates new cloned version of the <see cref="SubtreeeXPathNavigator"/>. /// </summary> /// <returns>Cloned copy of the <see cref="SubtreeeXPathNavigator"/>.</returns> public override XPathNavigator Clone() { System.Diagnostics.Debug.WriteLine("Clone()"); return new DebuggingXPathNavigator(_navigator.Clone()); } /// <summary> /// See <see cref="XPathNavigator.IsSamePosition"/>. /// </summary> public override bool IsSamePosition(XPathNavigator other) { bool res = _navigator.IsSamePosition(other); System.Diagnostics.Debug.WriteLine("IsSamePosition(" + (other != null ? other.ToString() : "null") + ") = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToId"/>. /// </summary> public override bool MoveToId(string id) { bool res = _navigator.MoveToId(id); System.Diagnostics.Debug.WriteLine("MoveToId(" + id + ") = " + res); return res; } #region Element methods /// <summary> /// See <see cref="XPathNavigator.MoveTo"/>. /// </summary> public override bool MoveTo(XPathNavigator other) { bool res = _navigator.MoveTo(other); System.Diagnostics.Debug.WriteLine("MoveTo(" + (other != null ? other.ToString() : "null") + ") = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToFirst"/>. /// </summary> public override bool MoveToFirst() { bool res = _navigator.MoveToFirst(); System.Diagnostics.Debug.WriteLine("MoveToFirst() = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToFirstChild"/>. /// </summary> public override bool MoveToFirstChild() { bool res = _navigator.MoveToFirstChild(); System.Diagnostics.Debug.WriteLine("MoveToFirstChild() = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToNext"/>. /// </summary> public override bool MoveToNext() { bool res = _navigator.MoveToNext(); System.Diagnostics.Debug.WriteLine("MoveToNext() = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToParent"/>. /// </summary> public override bool MoveToParent() { bool res = _navigator.MoveToParent(); System.Diagnostics.Debug.WriteLine("MoveToParent() = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToPrevious"/>. /// </summary> public override bool MoveToPrevious() { bool res = _navigator.MoveToPrevious(); System.Diagnostics.Debug.WriteLine("MoveToPrevious() = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToRoot"/>. /// </summary> public override void MoveToRoot() { System.Diagnostics.Debug.WriteLine("MoveToRoot()"); _navigator.MoveToRoot(); } #endregion Element methods #region Attribute methods /// <summary> /// See <see cref="XPathNavigator.GetAttribute"/>. /// </summary> public override string GetAttribute(string localName, string namespaceURI) { string attr = _navigator.GetAttribute(localName, namespaceURI); System.Diagnostics.Debug.WriteLine("GetAttribute(" + localName + ", " + namespaceURI + ") = " + attr); return attr; } /// <summary> /// See <see cref="XPathNavigator.MoveToAttribute"/>. /// </summary> public override bool MoveToAttribute(string localName, string namespaceURI) { bool res = _navigator.MoveToAttribute(localName, namespaceURI); System.Diagnostics.Debug.WriteLine("MoveToAttribute(" + localName + ", " + namespaceURI + ") = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToFirstAttribute"/>. /// </summary> public override bool MoveToFirstAttribute() { bool res = _navigator.MoveToFirstAttribute(); System.Diagnostics.Debug.WriteLine("MoveToFirstAttribute() = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToNextAttribute"/>. /// </summary> public override bool MoveToNextAttribute() { bool res = _navigator.MoveToNextAttribute(); System.Diagnostics.Debug.WriteLine("MoveToNextAttribute() = " + res); return res; } #endregion Attribute methods #region Namespace methods /// <summary> /// See <see cref="XPathNavigator.GetNamespace"/>. /// </summary> public override string GetNamespace(string localName) { string attr = _navigator.GetNamespace(localName); System.Diagnostics.Debug.WriteLine("GetNamespace(" + localName + ") = " + attr); return attr; } /// <summary> /// See <see cref="XPathNavigator.MoveToNamespace"/>. /// </summary> public override bool MoveToNamespace(string @namespace) { bool res = _navigator.MoveToNamespace(@namespace); System.Diagnostics.Debug.WriteLine("MoveToNamespace(" + @namespace + ") = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToFirstNamespace"/>. /// </summary> public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope) { bool res = _navigator.MoveToFirstNamespace(); System.Diagnostics.Debug.WriteLine("MoveToFirstNamespace() = " + res); return res; } /// <summary> /// See <see cref="XPathNavigator.MoveToNextNamespace"/>. /// </summary> public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope) { bool res = _navigator.MoveToNextNamespace(namespaceScope); System.Diagnostics.Debug.WriteLine("MoveToNextNamespace(" + namespaceScope + ") = " + res); return res; } #endregion Namespace methods #endregion Methods #endregion } } --- NEW FILE: library.xml --- <library> <book genre='novel' ISBN='1-861001-57-5'> <title>Pride And Prejudice</title> </book> <book genre='novel' ISBN='1-81920-21-2'> <title>Hook</title> </book> </library> --- NEW FILE: pubs.xml --- <?xml version="1.0" standalone="yes"?> <dsPubs id="123"> <publishers> <pub_id>0736</pub_id> <pub_name>New Moon Books</pub_name> <city>Boston</city> <state>MA</state> <country>USA</country> <titles xmlns:kzu="urn-kzu"> <kzu:test kzu:value="pepe">Data</kzu:test> <title_id>BU2075</title_id> <title>You Can Combat Computer Stress!</title> <type>business </type> <pub_id>0736</pub_id> <price>2.99</price> <advance>10125</advance> <royalty>24</royalty> <ytd_sales>18722</ytd_sales> <notes>The latest medical and psychological techniques for living with the electronic office. Easy-to-understand explanations.</notes> <pubdate>1991-06-30T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS2091</title_id> <title>Is Anger the Enemy?</title> <type>psychology </type> <pub_id>0736</pub_id> <price>10.95</price> <advance>2275</advance> <royalty>12</royalty> <ytd_sales>2045</ytd_sales> <notes>Carefully researched study of the effects of strong emotions on the body. Metabolic charts included.</notes> <pubdate>1991-06-15T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS2106</title_id> <title>Life Without Fear</title> <type>psychology </type> <pub_id>0736</pub_id> <price>7</price> <advance>6000</advance> <royalty>10</royalty> <ytd_sales>111</ytd_sales> <notes>New exercise, meditation, and nutritional techniques that can reduce the shock of daily interactions. Popular audience. Sample menus included, exercise video available separately.</notes> <pubdate>1991-10-05T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS3333</title_id> <title>Prolonged Data Deprivation: Four Case Studies</title> <type>psychology </type> <pub_id>0736</pub_id> <price>19.99</price> <advance>2000</advance> <royalty>10</royalty> <ytd_sales>4072</ytd_sales> <notes>What happens when the data runs dry? Searching evaluations of information-shortage effects.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS7777</title_id> <title>Emotional Security: A New Algorithm</title> <type>psychology </type> <pub_id>0736</pub_id> <price>7.99</price> <advance>4000</advance> <royalty>10</royalty> <ytd_sales>3336</ytd_sales> <notes>Protecting yourself and your loved ones from undue emotional stress in the modern world. Use of computer and nutritional aids emphasized.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> </publishers> <publishers> <pub_id>0877</pub_id> <pub_name>Binnet & Hardley</pub_name> <city>Washington</city> <state>DC</state> <country>USA</country> <titles> <title_id>MC2222</title_id> <title>Silicon Valley Gastronomic Treats</title> <type>mod_cook </type> <pub_id>0877</pub_id> <price>19.99</price> <advance>0</advance> <royalty>12</royalty> <ytd_sales>2032</ytd_sales> <notes>Favorite recipes for quick, easy, and elegant meals.</notes> <pubdate>1991-06-09T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>MC3021</title_id> <title>The Gourmet Microwave</title> <type>mod_cook </type> <pub_id>0877</pub_id> <price>2.99</price> <advance>15000</advance> <royalty>24</royalty> <ytd_sales>22246</ytd_sales> <notes>Traditional French gourmet recipes adapted for modern microwave cooking.</notes> <pubdate>1991-06-18T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>MC3026</title_id> <title>The Psychology of Computer Cooking</title> <type>UNDECIDED </type> <pub_id>0877</pub_id> <pubdate>2000-08-06T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PS1372</title_id> <title>Computer Phobic AND Non-Phobic Individuals: Behavior Variations</title> <type>psychology </type> <pub_id>0877</pub_id> <price>21.59</price> <advance>7000</advance> <royalty>10</royalty> <ytd_sales>375</ytd_sales> <notes>A must for the specialist, this book examines the difference between those who hate and fear computers and those who don't.</notes> <pubdate>1991-10-21T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>TC3218</title_id> <title>Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean</title> <type>trad_cook </type> <pub_id>0877</pub_id> <price>20.95</price> <advance>7000</advance> <royalty>10</royalty> <ytd_sales>375</ytd_sales> <notes>Profusely illustrated in color, this makes a wonderful gift book for a cuisine-oriented friend.</notes> <pubdate>1991-10-21T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>TC4203</title_id> <title>Fifty Years in Buckingham Palace Kitchens</title> <type>trad_cook </type> <pub_id>0877</pub_id> <price>11.95</price> <advance>4000</advance> <royalty>14</royalty> <ytd_sales>15096</ytd_sales> <notes>More anecdotes from the Queen's favorite cook describing life among English royalty. Recipes, techniques, tender vignettes.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>TC7777</title_id> <title>Sushi, Anyone?</title> <type>trad_cook </type> <pub_id>0877</pub_id> <price>14.99</price> <advance>8000</advance> <royalty>10</royalty> <ytd_sales>4095</ytd_sales> <notes>Detailed instructions on how to make authentic Japanese sushi in your spare time.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> </publishers> <publishers> <pub_id>1389</pub_id> <pub_name>Algodata Infosystems</pub_name> <city>Berkeley</city> <state>CA</state> <country>USA</country> <titles> <title_id>BU1032</title_id> <title>The Busy Executive's Database Guide</title> <type>business </type> <pub_id>1389</pub_id> <price>19.99</price> <advance>5000</advance> <royalty>10</royalty> <ytd_sales>4095</ytd_sales> <notes>An overview of available database systems with emphasis on common business applications. Illustrated.</notes> <pubdate>1991-06-12T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>BU1111</title_id> <title>Cooking with Computers: Surreptitious Balance Sheets</title> <type>business </type> <pub_id>1389</pub_id> <price>11.95</price> <advance>5000</advance> <royalty>10</royalty> <ytd_sales>3876</ytd_sales> <notes>Helpful hints on how to use your electronic resources to the best advantage.</notes> <pubdate>1991-06-09T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>BU7832</title_id> <title>Straight Talk About Computers</title> <type>business </type> <pub_id>1389</pub_id> <price>19.99</price> <advance>5000</advance> <royalty>10</royalty> <ytd_sales>4095</ytd_sales> <notes>Annotated analysis of what computers can do for you: a no-hype guide for the critical user.</notes> <pubdate>1991-06-22T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PC1035</title_id> <title>But Is It User Friendly?</title> <type>popular_comp</type> <pub_id>1389</pub_id> <price>22.95</price> <advance>7000</advance> <royalty>16</royalty> <ytd_sales>8780</ytd_sales> <notes>A survey of software for the naive user, focusing on the 'friendliness' of each.</notes> <pubdate>1991-06-30T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PC8888</title_id> <title>Secrets of Silicon Valley</title> <type>popular_comp</type> <pub_id>1389</pub_id> <price>20</price> <advance>8000</advance> <royalty>10</royalty> <ytd_sales>4095</ytd_sales> <notes>Muckraking reporting on the world's largest computer hardware and software manufacturers.</notes> <pubdate>1994-06-12T00:00:00.0000000-03:00</pubdate> </titles> <titles> <title_id>PC9999</title_id> <title>Net Etiquette</title> <type>popular_comp</type> <pub_id>1389</pub_id> <notes>A must-read for computer conferencing.</notes> <pubdate>2000-08-06T00:00:00.0000000-03:00</pubdate> </titles> </publishers> <publishers> <pub_id>1622</pub_id> <pub_name>Five Lakes Publishing</pub_name> <city>Chicago</city> <state>IL</state> <country>USA</country> </publishers> <publishers> <pub_id>1756</pub_id> <pub_name>Ramona Publishers</pub_name> <city>Dallas</city> <state>TX</state> <country>USA</country> </publishers> <publishers> <pub_id>9901</pub_id> <pub_name>GGG&G</pub_name> <city>München</city> <country>Germany</country> </publishers> <publishers> <pub_id>9952</pub_id> <pub_name>Scootney Books</pub_name> <city>New York</city> <state>NY</state> <country>USA</country> </publishers> <publishers> <pub_id>9999</pub_id> <pub_name>Lucerne Publishing</pub_name> <city>Paris</city> <country>France</country> </publishers> </dsPubs> --- NEW FILE: pubsNs.xml --- <?xml version="1.0" standalone="yes"?> <dsPubs id="123" xmlns="mvp-xml"> <publishers> <pub_id>0736</pub_id> <pub_name>New Moon Books</pub_name> <city>Boston</city> <state>MA</state> <country>USA</country> <titles> <title_id>BU2075</title_id> <title>You Can Combat Computer Stress!</title> <type>business </type> <pub_id>0736</pub_id> <price>2.99</price> <advance>10125</advance> <royalty>24</royalty> <ytd_sales>18722</ytd_sales> <notes>The latest medical and psychological techniques for living with the electronic office. Easy-to-understand explanations.</notes> <pubdate>1991-06-30T00:00:00.0000000-03:00</pubdate> [...1193 lines suppressed...] <pub_id>1389</pub_id> <notes>A must-read for computer conferencing.</notes> <pubdate>2000-08-06T00:00:00.0000000-03:00</pubdate> </titles> </publishers> <publishers> <pub_id>1622</pub_id> <pub_name>Five Lakes Publishing</pub_name> <city>Chicago</city> <state>IL</state> <country>USA</country> </publishers> <publishers> <pub_id>1756</pub_id> <pub_name>Ramona Publishers</pub_name> <city>Dallas</city> <state>TX</state> <country>USA</country> </publishers> </dsPubs> --- NEW FILE: northwind.xml --- <?xml version="1.0" encoding="windows-1252"?> <ROOT> <CustomerIDs> <CustomerID> ALFKI</CustomerID> <CompanyName> Alfreds Futterkiste</CompanyName> <ContactName> Maria Anders</ContactName> <OrderIDs> <Item> <OrderID> 10952</OrderID> <OrderDate> 4/15/96</OrderDate> <ShipAddress> Obere Str. 57</ShipAddress> </Item> <Item> <OrderID> 10643</OrderID> <OrderDate> 9/25/95</OrderDate> <ShipAddress> Obere Str. 57</ShipAddress> </Item> <Item> <OrderID> 10702</OrderID> [...4607 lines suppressed...] <ShipAddress> ul. Filtrowa 68</ShipAddress> </Item> <Item> <OrderID> 10870</OrderID> <OrderDate> 3/6/96</OrderDate> <ShipAddress> ul. Filtrowa 68</ShipAddress> </Item> <Item> <OrderID> 10611</OrderID> <OrderDate> 8/25/95</OrderDate> <ShipAddress> ul. Filtrowa 68</ShipAddress> </Item> <Item> <OrderID> 11044</OrderID> <OrderDate> 5/23/96</OrderDate> <ShipAddress> ul. Filtrowa 68</ShipAddress> </Item> </OrderIDs> </CustomerIDs> </ROOT> --- NEW FILE: XmlNodeFactoryTests.cs --- #region using using System; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Xml.XPath; using NUnit.Framework; using Mvp.Xml.Common; #endregion using namespace Mvp.Xml.Tests { /// <summary> /// </summary> [TestFixture] public class XmlNodeFactoryTests { static XmlSerializer ser = new XmlSerializer(typeof(XmlNode)); [Test] public void NodeFromReader() { string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><root><element>1</element><element></element><element>2</element></root>"; XmlTextReader tr = new XmlTextReader(new StringReader(xml)); XmlNode node = XmlNodeFactory.Create(tr); MemoryStream mem = new MemoryStream(); XmlTextWriter tw = new XmlTextWriter(mem, System.Text.Encoding.UTF8); tw.Formatting = Formatting.None; ser.Serialize(tw, node); mem.Position = 0; string res = new StreamReader(mem).ReadToEnd(); Assert.AreEqual(xml, res); } [Test] public void NodeFromNavigator() { string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><root><element>1</element><element /><element>2</element></root>"; XPathDocument doc = new XPathDocument(new StringReader(xml)); XPathNavigator nav = doc.CreateNavigator(); XmlNode node = XmlNodeFactory.Create(nav); MemoryStream mem = new MemoryStream(); XmlTextWriter tw = new XmlTextWriter(mem, System.Text.Encoding.UTF8); tw.Formatting = Formatting.None; ser.Serialize(tw, node); mem.Position = 0; string res = new StreamReader(mem).ReadToEnd(); Assert.AreEqual(xml, res); nav.MoveToRoot(); nav.MoveToFirstChild(); nav.MoveToFirstChild(); node = XmlNodeFactory.Create(nav); mem = new MemoryStream(); tw = new XmlTextWriter(mem, System.Text.Encoding.UTF8); tw.Formatting = Formatting.None; ser.Serialize(tw, node); mem.Position = 0; res = new StreamReader(mem).ReadToEnd(); Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-8\"?><element>1</element>", res); } [Test] public void NodeFromObject() { Customer cust = new Customer(); cust.FirstName = "Daniel"; cust.LastName = "Cazzulino"; XmlNode node = XmlNodeFactory.Create(cust); MemoryStream mem = new MemoryStream(); XmlTextWriter tw = new XmlTextWriter(mem, System.Text.Encoding.UTF8); tw.Formatting = Formatting.None; ser.Serialize(tw, node); mem.Position = 0; XmlSerializer customerSerializer = new XmlSerializer(typeof(Customer)); Customer result = (Customer) customerSerializer.Deserialize(mem); Assert.AreEqual(cust.FirstName, result.FirstName); Assert.AreEqual(cust.LastName, result.LastName); Assert.AreEqual(cust.BirthDate, result.BirthDate); } public class Customer { public string FirstName; public string LastName; public DateTime BirthDate; } } } --- NEW FILE: XPathCacheUsability.cs --- using System; using System.Xml; using System.Xml.XPath; using Mvp.Xml.Common.XPath; namespace Mvp.Xml.Tests { public class XPathCacheUsability { /// <summary> /// This code is just to show how it's used. /// If run it will throw exceptions. /// </summary> public void Test() { XPathNavigator document = new XPathDocument(String.Empty).CreateNavigator(); XPathNodeIterator it = XPathCache.Select("/customer/order/item", document); it = XPathCache.Select("/customer/order[id=$id]/item", document, new XPathVariable("id", "23")); string[] ids = null; foreach (string id in ids) { it = XPathCache.Select("/customer/order[id=$id]/item", document, new XPathVariable("id", id)); } XmlNamespaceManager mgr = new XmlNamespaceManager(document.NameTable); mgr.AddNamespace("po", "example-po"); it = XPathCache.Select("/po:customer[id=$id]", document, mgr, new XPathVariable("id", "0736")); XmlDocument doc = new XmlDocument(); XmlNodeList list = XPathCache.SelectNodes("/customer", doc); } } } --- NEW FILE: Misc.cs --- using System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Xml; using System.Xml.Serialization; using System.Xml.XPath; using System.Xml.Schema; using NUnit.Framework; namespace Mvp.Xml.Tests { /// <summary> /// Miscelaneous tests. /// </summary> [TestFixture] public class Misc { [Test] public void SerializeXmlDocument() { XmlSerializer ser = new XmlSerializer(typeof(XmlDocument)); int j = 3; double k = (double) j ; short s = 1; double ds = (double) s; Assert.IsNotNull(ser); } [Test] public void CursorMovement() { XPathDocument doc = new XPathDocument(Globals.GetResource(Globals.NorthwindResource)); XPathNavigator nav = doc.CreateNavigator(); nav.MoveToFirstChild(); nav.MoveToFirstChild(); XPathNavigator prev = nav.Clone(); XPathNodeIterator it = nav.Select("//CustomerID"); Assert.IsTrue(nav.IsSamePosition(prev)); } } } --- NEW FILE: XPathSortBug.cs --- using System; using System.IO; using System.Xml; using System.Xml.XPath; using NUnit.Framework; namespace Mvp.Xml.Tests { /// <summary/> [TestFixture] public class XPathSortBug { [Test] public void Repro() { string xml = @" <root xmlns='mvp-xml'> <item> <value>25</value> </item> <item> <value>40</value> </item> <item> <value>10</value> </item> </root>"; XPathDocument doc = new XPathDocument(new StringReader(xml)); XPathNavigator nav = doc.CreateNavigator(); // Setup namespace resolution. XmlNamespaceManager ctx = new XmlNamespaceManager(nav.NameTable); ctx.AddNamespace("mvp", "mvp-xml"); // Create sort expression. XPathExpression sort = nav.Compile("mvp:value"); sort.SetContext(ctx); // Setting the sort *after* the context yields no results at all. XPathExpression items = nav.Compile("//mvp:item"); items.AddSort(sort, XmlSortOrder.Ascending, XmlCaseOrder.None, String.Empty, XmlDataType.Number); items.SetContext(ctx); XPathNodeIterator it = doc.CreateNavigator().Select(items); Assert.IsFalse( it.MoveNext() ); // The same code but setting the sort *after* the context works fine. items = nav.Compile("//mvp:item"); items.SetContext(ctx); items.AddSort(sort, XmlSortOrder.Ascending, XmlCaseOrder.None, String.Empty, XmlDataType.Number); it = doc.CreateNavigator().Select(items); Assert.IsTrue( it.MoveNext() ); } } } --- NEW FILE: DebuggingXmlTextReader.cs --- #region using using System; using System.IO; using System.Xml; #endregion using namespace Mvp.Xml.Tests { internal class DebuggingXmlTextReader : XmlTextReader { XmlReader _reader; public DebuggingXmlTextReader(Stream input) : base(new StringReader(String.Empty)) { _reader = new XmlTextReader(input); } public DebuggingXmlTextReader(TextReader input) : base(new StringReader(String.Empty)) { _reader = new XmlTextReader(input); } public DebuggingXmlTextReader(XmlReader input) : base(new StringReader(String.Empty)) { _reader = input; } public override int AttributeCount { get { System.Diagnostics.Debug.WriteLine("AttributeCount = " + _reader.AttributeCount); return _reader.AttributeCount; } } public override string BaseURI { get { System.Diagnostics.Debug.WriteLine("BaseURI = " + _reader.BaseURI); return _reader.BaseURI; } } public override bool CanResolveEntity { get { System.Diagnostics.Debug.WriteLine("CanResolveEntity = " + _reader.CanResolveEntity); return _reader.CanResolveEntity; } } public override void Close() { System.Diagnostics.Debug.WriteLine("Close"); _reader.Close(); } public override int Depth { get { System.Diagnostics.Debug.WriteLine("Depth = " + _reader.Depth); return _reader.Depth; } } public override bool EOF { get { System.Diagnostics.Debug.WriteLine("EOF = " + _reader.EOF); return _reader.EOF; } } public override string GetAttribute(int i) { System.Diagnostics.Debug.WriteLine("GetAttribute(" + i + ")"); return _reader.GetAttribute(i); } public override string GetAttribute(string name) { System.Diagnostics.Debug.WriteLine("GetAttribute(" + name + ")"); return _reader.GetAttribute(name); } public override string GetAttribute(string name, string namespaceURI) { System.Diagnostics.Debug.WriteLine("GetAttribute(" + name + "), " + namespaceURI + ")"); return _reader.GetAttribute(name, namespaceURI); } public override bool HasAttributes { get { System.Diagnostics.Debug.WriteLine("HasAttributes = " + _reader.HasAttributes); return _reader.HasAttributes; } } public override bool HasValue { get { System.Diagnostics.Debug.WriteLine("HasValue = " + _reader.HasValue); return _reader.HasValue; } } public override bool IsDefault { get { System.Diagnostics.Debug.WriteLine("IsDefault = " + _reader.IsDefault); return _reader.IsDefault; } } public override bool IsEmptyElement { get { System.Diagnostics.Debug.WriteLine("IsEmptyElement = " + _reader.IsEmptyElement); return _reader.IsEmptyElement; } } public override bool IsStartElement() { System.Diagnostics.Debug.WriteLine("IsStartElement()"); return _reader.IsStartElement (); } public override bool IsStartElement(string localname, string ns) { System.Diagnostics.Debug.WriteLine("IsStartElement(" + localname + ", " + ns + ")"); return _reader.IsStartElement (localname, ns); } public override bool IsStartElement(string name) { System.Diagnostics.Debug.WriteLine("IsStartElement(" + name + ")"); return _reader.IsStartElement (name); } public override string LocalName { get { System.Diagnostics.Debug.WriteLine("LocalName = " + _reader.LocalName); return _reader.LocalName; } } public override string LookupNamespace(string prefix) { System.Diagnostics.Debug.WriteLine("LookupNamespace(" + prefix + ")"); return _reader.Prefix; } public override void MoveToAttribute(int i) { System.Diagnostics.Debug.WriteLine("MoveToAttribute(" + i + ")"); _reader.MoveToAttribute(i); } public override bool MoveToAttribute(string name) { System.Diagnostics.Debug.WriteLine("MoveToAttribute(" + name + ")"); return _reader.MoveToAttribute(name); } public override bool MoveToAttribute(string name, string ns) { System.Diagnostics.Debug.WriteLine("MoveToAttribute(" + name + ", " + ns + ")"); return _reader.MoveToAttribute(name, ns); } public override XmlNodeType MoveToContent() { System.Diagnostics.Debug.WriteLine("MoveToContent()"); return _reader.MoveToContent(); } public override bool MoveToElement() { System.Diagnostics.Debug.WriteLine("MoveToElement()"); return _reader.MoveToElement(); } public override bool MoveToFirstAttribute() { System.Diagnostics.Debug.WriteLine("MoveToFirstAttribute()"); return _reader.MoveToFirstAttribute(); } public override bool MoveToNextAttribute() { System.Diagnostics.Debug.WriteLine("MoveToNextAttribute()"); return _reader.MoveToNextAttribute(); } public override string Name { get { System.Diagnostics.Debug.WriteLine("Name = " + _reader.Name); return _reader.Name; } } public override string NamespaceURI { get { System.Diagnostics.Debug.WriteLine("NamespaceURI = " + _reader.NamespaceURI); return _reader.NamespaceURI; } } public override XmlNameTable NameTable { get { System.Diagnostics.Debug.WriteLine("NameTable"); return _reader.NameTable; } } public override XmlNodeType NodeType { get { System.Diagnostics.Debug.WriteLine("NodeType = " + _reader.NodeType); return _reader.NodeType; } } public override string Prefix { get { System.Diagnostics.Debug.WriteLine("Prefix = " + _reader.Prefix); return _reader.Prefix; } } public override char QuoteChar { get { System.Diagnostics.Debug.WriteLine("QuoteChar = " + _reader.QuoteChar); return _reader.QuoteChar; } } public override bool Read() { System.Diagnostics.Debug.WriteLine("Read()"); return _reader.Read(); } public override bool ReadAttributeValue() { System.Diagnostics.Debug.WriteLine("ReadAttributeValue()"); return _reader.ReadAttributeValue(); } public override string ReadElementString() { System.Diagnostics.Debug.WriteLine("ReadElementString()"); return _reader.ReadElementString(); } public override string ReadElementString(string localname, string ns) { System.Diagnostics.Debug.WriteLine("ReadElementString(" + localname + ", " + ns + ")"); return _reader.ReadElementString(localname, ns); } public override string ReadElementString(string name) { System.Diagnostics.Debug.WriteLine("ReadElementString(" + name + ")"); return _reader.ReadElementString(name); } public override void ReadEndElement() { System.Diagnostics.Debug.WriteLine("ReadEndElement()"); _reader.ReadEndElement(); } public override string ReadInnerXml() { System.Diagnostics.Debug.WriteLine("ReadInnerXml()"); return _reader.ReadInnerXml(); } public override string ReadOuterXml() { System.Diagnostics.Debug.WriteLine("ReadOuterXml()"); return _reader.ReadOuterXml(); } public override void ReadStartElement() { System.Diagnostics.Debug.WriteLine("ReadStartElement()"); _reader.ReadStartElement(); } public override void ReadStartElement(string localname, string ns) { System.Diagnostics.Debug.WriteLine("ReadStartElement(" + localname + ", " + ns + ")"); _reader.ReadStartElement(localname, ns); } public override void ReadStartElement(string name) { System.Diagnostics.Debug.WriteLine("ReadStartElement(" + name + ")"); _reader.ReadStartElement(name); } public override ReadState ReadState { get { System.Diagnostics.Debug.WriteLine("ReadState = " + _reader.ReadState); return _reader.ReadState; } } public override string ReadString() { System.Diagnostics.Debug.WriteLine("ReadString()"); return _reader.ReadString(); } public override void ResolveEntity() { System.Diagnostics.Debug.WriteLine("ResolveEntity()"); _reader.ResolveEntity(); } public override void Skip() { System.Diagnostics.Debug.WriteLine("Skip()"); _reader.Skip(); } public override string this[int i] { get { System.Diagnostics.Debug.WriteLine("this[" + i + "]"); return base[i]; } } public override string this[string name, string namespaceURI] { get { System.Diagnostics.Debug.WriteLine("this[" + name + ", " + namespaceURI + "]"); return base[name, namespaceURI]; } } public override string this[string name] { get { System.Diagnostics.Debug.WriteLine("this[" + name + "]"); return base[name]; } } public override string Value { get { System.Diagnostics.Debug.WriteLine("Value = " + _reader.Value); return _reader.Value; } } public override string XmlLang { get { System.Diagnostics.Debug.WriteLine("XmlLang = " + _reader.XmlLang); return _reader.XmlLang; } } public override XmlSpace XmlSpace { get { System.Diagnostics.Debug.WriteLine("XmlSpace = " + _reader.XmlSpace); return _reader.XmlSpace; } } } } --- NEW FILE: pubsNs.cs --- namespace Mvp.Xml.Tests { /// <remarks/> [System.Xml.Serialization.XmlTypeAttribute(Namespace="mvp-xml")] [System.Xml.Serialization.XmlRootAttribute(Namespace="mvp-xml", IsNullable=false)] public class dsPubs { /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("publishers")] public dsPubsPublishers[] publishers; /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string id; } /// <remarks/> [System.Xml.Serialization.XmlTypeAttribute(Namespace="mvp-xml")] public class dsPubsPublishers { /// <remarks/> public System.UInt16 pub_id; /// <remarks/> public string pub_name; /// <remarks/> public string city; /// <remarks/> public string state; /// <remarks/> public string country; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("titles")] public dsPubsPublishersTitles[] titles; } /// <remarks/> [System.Xml.Serialization.XmlTypeAttribute(Namespace="mvp-xml")] public class dsPubsPublishersTitles { /// <remarks/> public string title_id; /// <remarks/> public string title; /// <remarks/> public string type; /// <remarks/> public System.UInt16 pub_id; /// <remarks/> public System.Decimal price; /// <remarks/> [System.Xml.Serialization.XmlIgnoreAttribute()] public bool priceSpecified; /// <remarks/> public System.UInt16 advance; /// <remarks/> [System.Xml.Serialization.XmlIgnoreAttribute()] public bool advanceSpecified; /// <remarks/> public System.Byte royalty; /// <remarks/> [System.Xml.Serialization.XmlIgnoreAttribute()] public bool royaltySpecified; /// <remarks/> public System.UInt16 ytd_sales; /// <remarks/> [System.Xml.Serialization.XmlIgnoreAttribute()] public bool ytd_salesSpecified; /// <remarks/> public string notes; /// <remarks/> public System.DateTime pubdate; } } --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")] // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project output directory which is // %Project Directory%\obj\<configuration>. For example, if your KeyFile is // located in the project directory, you would specify the AssemblyKeyFile // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] --- NEW FILE: XPathCacheTests.cs --- using System; using System.Xml; using System.Xml.XPath; using Mvp.Xml.Common; using Mvp.Xml.Common.XPath; using NUnit.Framework; namespace Mvp.Xml.Tests { [TestFixture] public class XPathCacheTests { private XPathDocument Document; private XPathDocument DocumentNoNs; [SetUp] public void Setup() { Document = new XPathDocument(Globals.GetResource(Globals.PubsNsResource)); DocumentNoNs = new XPathDocument(Globals.GetResource(Globals.PubsResource)); } [TearDown] public void TearDown() { Document = null; } [Test] public void DefaultNamespace() { dsPubs pubs = new dsPubs(); pubs.id = "0736"; System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(dsPubs), String.Empty); System.IO.StringWriter sw = new System.IO.StringWriter(); ser.Serialize( sw, pubs ); string xml = sw.ToString(); Assert.IsNotNull(xml); } [Test] public void DynamicVariable() { string expr = "//mvp:titles[mvp:price > 10]"; string dyn = "//mvp:titles[mvp:price > $price]"; int price = 10; XPathNavigator docnav = Document.CreateNavigator(); XPathExpression xpath = docnav.Compile(expr); XmlNamespaceManager mgr = new XmlNamespaceManager(docnav.NameTable); mgr.AddNamespace(Globals.MvpPrefix, Globals.MvpNamespace); xpath.SetContext(mgr); int count1 = Document.CreateNavigator().Select(xpath).Count; // Test with compiled expression. int count2 = XPathCache.Select(expr, Document.CreateNavigator(), mgr).Count; Assert.AreEqual(count1, count2); // Test with dynamic expression. count2 = XPathCache.Select(dyn, Document.CreateNavigator(), mgr, new XPathVariable("price", price)).Count; Assert.AreEqual(count1, count2); } [Test] public void PrefixMapping() { string expr = "//mvp:titles[mvp:price > 10]"; XPathNavigator docnav = Document.CreateNavigator(); XPathExpression xpath = docnav.Compile(expr); XmlNamespaceManager mgr = new XmlNamespaceManager(docnav.NameTable); mgr.AddNamespace(Globals.MvpPrefix, Globals.MvpNamespace); xpath.SetContext(mgr); int count1 = Document.CreateNavigator().Select(xpath).Count; int count2 = XPathCache.Select(expr, Document.CreateNavigator(), new XmlPrefix(Globals.MvpPrefix, Globals.MvpNamespace, Document.CreateNavigator().NameTable)).Count; Assert.AreEqual(count1, count2); } [Test] public void Sorted1() { string expr = "//mvp:titles"; XPathNavigator docnav = Document.CreateNavigator(); XPathExpression xpath = docnav.Compile(expr); XmlNamespaceManager mgr = new XmlNamespaceManager(docnav.NameTable); mgr.AddNamespace(Globals.MvpPrefix, Globals.MvpNamespace); xpath.SetContext(mgr); XPathExpression sort = docnav.Compile("mvp:price"); sort.SetContext(mgr); xpath.AddSort(sort, XmlSortOrder.Ascending, XmlCaseOrder.LowerFirst, String.Empty, XmlDataType.Number); XPathNodeIterator it = Document.CreateNavigator().Select(xpath); DebugUtils.XPathNodeIteratorToConsole(it); it = Document.CreateNavigator().Select(xpath); it.MoveNext(); it.Current.MoveToFirstChild(); string id1 = it.Current.Value; XPathNodeIterator cached = XPathCache.SelectSorted( expr, Document.CreateNavigator(), "mvp:price", XmlSortOrder.Ascending, XmlCaseOrder.LowerFirst, String.Empty, XmlDataType.Number, new XmlPrefix(Globals.MvpPrefix, Globals.MvpNamespace, Document.CreateNavigator().NameTable)); DebugUtils.XPathNodeIteratorToConsole(cached); cached = XPathCache.SelectSorted( expr, Document.CreateNavigator(), "mvp:price", XmlSortOrder.Ascending, XmlCaseOrder.LowerFirst, String.Empty, XmlDataType.Number, new XmlPrefix(Globals.MvpPrefix, Globals.MvpNamespace, Document.CreateNavigator().NameTable)); cached.MoveNext(); cached.Current.MoveToFirstChild(); string id2 = cached.Current.Value; Assert.AreEqual(id1, id2); } } } --- NEW FILE: IndexingXPathNavigatorTest.cs --- using System; using System.Xml; using System.Xml.XPath; using System.Diagnostics; using Mvp.Xml.Common.XPath; using NUnit.Framework; namespace Mvp.Xml.Tests { /// <summary> /// Test class for IndexingXPathNavigator /// </summary> [TestFixture] public class IndexingXPathNavigatorTest { [Test] public void RunTests() { Main(new string[0]); } [STAThread] static void Main(string[] args) { Stopwatch stopWatch = new Stopwatch(); int repeat = 1000; stopWatch.Start(); XPathDocument doc = new XPathDocument(Globals.GetResource(Globals.NorthwindResource)); //XmlDocument doc = new XmlDocument(); //doc.Load("test/northwind.xml"); stopWatch.Stop(); Console.WriteLine("Loading XML document: {0, 6:f2} ms", stopWatch.ElapsedMilliseconds); XPathNavigator nav = doc.CreateNavigator(); XPathExpression expr = nav.Compile("/ROOT/CustomerIDs/OrderIDs/Item[OrderID=' 10330']/ShipAddress"); Console.WriteLine("Regular selection, warming..."); SelectNodes(nav, repeat, stopWatch, expr); Console.WriteLine("Regular selection, testing..."); SelectNodes(nav, repeat, stopWatch, expr); stopWatch.Start(); IndexingXPathNavigator inav = new IndexingXPathNavigator( doc.CreateNavigator()); stopWatch.Stop(); Console.WriteLine("Building IndexingXPathNavigator: {0, 6:f2} ms", stopWatch.ElapsedMilliseconds); stopWatch.Start(); inav.AddKey("orderKey", "OrderIDs/Item", "OrderID"); stopWatch.Stop(); Console.WriteLine("Adding keys: {0, 6:f2} ms", stopWatch.ElapsedMilliseconds); XPathExpression expr2 = inav.Compile("key('orderKey', ' 10330')/ShipAddress"); stopWatch.Start(); inav.BuildIndexes(); stopWatch.Stop(); Console.WriteLine("Indexing: {0, 6:f2} ms", stopWatch.ElapsedMilliseconds); Console.WriteLine("Indexed selection, warming..."); SelectIndexedNodes(inav, repeat, stopWatch, expr2); Console.WriteLine("Indexed selection, testing..."); SelectIndexedNodes(inav, repeat, stopWatch, expr2); } private static void SelectNodes(XPathNavigator nav, int repeat, Stopwatch stopWatch, XPathExpression expr) { int counter = 0; stopWatch.Start(); for (int i=0; i<repeat; i++) { XPathNodeIterator ni = nav.Select(expr); while (ni.MoveNext()) counter++; } stopWatch.Stop(); Console.WriteLine("Regular selection: {0} times, total time {1, 6:f2} ms, {2} nodes selected", repeat, stopWatch.ElapsedMilliseconds, counter); } private static void SelectIndexedNodes(XPathNavigator nav, int repeat, Stopwatch stopWatch, XPathExpression expr) { int counter = 0; stopWatch.Start(); for (int i=0; i<repeat; i++) { XPathNodeIterator ni = nav.Select(expr); while (ni.MoveNext()) counter++; } stopWatch.Stop(); Console.WriteLine("Indexed selection: {0} times, total time {1, 6:f2} ms, {2} nodes selected", repeat, stopWatch.ElapsedMilliseconds, counter); } } } |
From: Oleg T. <he...@us...> - 2005-10-25 21:33:53
|
Update of /cvsroot/mvp-xml/Common/v2/test/XmlBaseAwareXmlTextReaderTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1205/v2/test/XmlBaseAwareXmlTextReaderTests Added Files: Tests.cs relativeTest.xml test.xml Log Message: --- NEW FILE: test.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Tests.cs --- using System; using System.Xml; using System.Xml.XPath; using Mvp.Xml.Common; using NUnit.Framework; namespace Mvp.Xml.Tests.XmlBaseAwareXmlTextReaderTests { [TestFixture] public class Tests { [Test] public void BasicTest() { XmlTextReader r = new XmlBaseAwareXmlTextReader( Globals.GetResource( this.GetType().Namespace + ".test.xml")); while (r.Read()) { if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "catalog": Assert.IsTrue(r.BaseURI == ""); break; case "files": Assert.IsTrue(r.BaseURI == "file:///d:/Files/"); break; case "file": Assert.IsTrue(r.BaseURI == "file:///d:/Files/"); break; case "a": Assert.IsTrue(r.BaseURI == ""); break; case "b": Assert.IsTrue(r.BaseURI == "file:///d:/Files/a/"); break; case "c": Assert.IsTrue(r.BaseURI == "file:///d:/Files/c/"); break; case "e": Assert.IsTrue(r.BaseURI == "file:///d:/Files/c/"); break; case "d": Assert.IsTrue(r.BaseURI == "file:///d:/Files/a/"); break; } } else if (r.NodeType == XmlNodeType.Text && r.Value.Trim() != "") { Assert.IsTrue(r.BaseURI == "file:///d:/Files/c/"); } else if (r.NodeType == XmlNodeType.Comment) { Assert.IsTrue(r.BaseURI == "file:///d:/Files/a/"); } else if (r.NodeType == XmlNodeType.ProcessingInstruction) { Assert.IsTrue(r.BaseURI == "file:///d:/Files/"); } } r.Close(); } [Test] public void ReaderWithPath() { XmlTextReader r = new XmlBaseAwareXmlTextReader(@"..\..\XmlBaseAwareXmlTextReaderTests\relativeTest.xml"); r.WhitespaceHandling = WhitespaceHandling.None; XPathDocument doc = new XPathDocument(r); XPathNavigator nav = doc.CreateNavigator(); XPathNodeIterator ni = nav.Select("/catalog"); ni.MoveNext(); Assert.IsTrue(ni.Current.BaseURI.EndsWith("/XmlBaseAwareXmlTextReaderTests/relativeTest.xml")); ni = nav.Select("/catalog/relative/relativenode"); ni.MoveNext(); Console.WriteLine(ni.Current.BaseURI); Assert.IsTrue(ni.Current.BaseURI.IndexOf("/XmlBaseAwareXmlTextReaderTests/") != -1); } } } --- NEW FILE: relativeTest.xml --- (This appears to be a binary file; contents omitted.) |
From: Oleg T. <he...@us...> - 2005-10-25 21:30:14
|
Update of /cvsroot/mvp-xml/Common/v2/test/XmlBaseAwareXmlTextReaderTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv446/XmlBaseAwareXmlTextReaderTests Log Message: Directory /cvsroot/mvp-xml/Common/v2/test/XmlBaseAwareXmlTextReaderTests added to the repository |
From: Oleg T. <he...@us...> - 2005-10-25 21:30:14
|
Update of /cvsroot/mvp-xml/Common/v2/test/XPathIteratorReaderTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv446/XPathIteratorReaderTests Log Message: Directory /cvsroot/mvp-xml/Common/v2/test/XPathIteratorReaderTests added to the repository |
From: Oleg T. <he...@us...> - 2005-10-25 21:30:13
|
Update of /cvsroot/mvp-xml/Common/v2/test/SubtreeeXPathNavigatorTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv446/SubtreeeXPathNavigatorTests Log Message: Directory /cvsroot/mvp-xml/Common/v2/test/SubtreeeXPathNavigatorTests added to the repository |
From: Oleg T. <he...@us...> - 2005-10-25 21:30:13
|
Update of /cvsroot/mvp-xml/Common/v2/test/UpperLowerTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv446/UpperLowerTests Log Message: Directory /cvsroot/mvp-xml/Common/v2/test/UpperLowerTests added to the repository |
From: Oleg T. <he...@us...> - 2005-10-25 21:30:13
|
Update of /cvsroot/mvp-xml/Common/v2/test/XmlFragments In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv446/XmlFragments Log Message: Directory /cvsroot/mvp-xml/Common/v2/test/XmlFragments added to the repository |
From: Oleg T. <he...@us...> - 2005-10-25 21:29:52
|
Update of /cvsroot/mvp-xml/Common/v2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv365/test Log Message: Directory /cvsroot/mvp-xml/Common/v2/test added to the repository |
From: Oleg T. <he...@us...> - 2005-10-24 12:08:45
|
Update of /cvsroot/mvp-xml/Common/v2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32166/v2/src Modified Files: Common.csproj XmlBaseAwareXmlTextReader.cs changelog.txt Log Message: Index: changelog.txt =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/changelog.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- changelog.txt 16 Oct 2005 16:51:24 -0000 1.1 +++ changelog.txt 24 Oct 2005 12:08:27 -0000 1.2 @@ -1,3 +1,9 @@ +October 24, 2005 + +Converted to .NET 2.0 (olegt) + +--------------------------------------------------------- + May 28, 2005 Added ObjectNode to XmlNodeFactory to improve performance of client-side message-based communication with web services through XmlSerializer. Index: XmlBaseAwareXmlTextReader.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/XmlBaseAwareXmlTextReader.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- XmlBaseAwareXmlTextReader.cs 16 Oct 2005 16:51:24 -0000 1.1 +++ XmlBaseAwareXmlTextReader.cs 24 Oct 2005 12:08:27 -0000 1.2 @@ -12,6 +12,9 @@ /// <summary> /// XmlTextReader supporting <a href="http://www.w3.org/TR/xmlbase/">XML Base</a>. /// </summary> + /// <remarks> + /// <para>Author: Oleg Tkachenko, ol...@xm...</para> + /// </remarks> public class XmlBaseAwareXmlTextReader : XmlTextReader { #region private Index: Common.csproj =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/Common.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Common.csproj 19 Oct 2005 14:39:55 -0000 1.2 +++ Common.csproj 24 Oct 2005 12:08:27 -0000 1.3 @@ -77,15 +77,6 @@ <Reference Include="System"> <Name>System</Name> </Reference> - <Reference Include="System.Configuration.Install"> - <Name>System.Configuration.Install</Name> - </Reference> - <Reference Include="System.Data"> - <Name>System.Data</Name> - </Reference> - <Reference Include="System.Management"> - <Name>System.Management</Name> - </Reference> <Reference Include="System.Xml"> <Name>System.XML</Name> </Reference> |