Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / TemplateManager.cs / 1305376 / TemplateManager.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; using System.Xml.XPath; using System.Collections; internal class TemplateManager { private XmlQualifiedName mode; internal ArrayList templates; private Stylesheet stylesheet; // Owning stylesheet private class TemplateComparer : IComparer { public int Compare(object x, object y) { Debug.Assert(x != null && x is TemplateAction); Debug.Assert(y != null && y is TemplateAction); TemplateAction tx = (TemplateAction) x; TemplateAction ty = (TemplateAction) y; Debug.Assert(! Double.IsNaN(tx.Priority)); Debug.Assert(! Double.IsNaN(ty.Priority)); if (tx.Priority == ty.Priority) { Debug.Assert(tx.TemplateId != ty.TemplateId || tx == ty); return tx.TemplateId - ty.TemplateId; } else { return tx.Priority > ty.Priority ? 1 : -1; } } } private static TemplateComparer s_TemplateComparer = new TemplateComparer(); internal XmlQualifiedName Mode { get { return this.mode; } } internal TemplateManager(Stylesheet stylesheet, XmlQualifiedName mode) { this.mode = mode; this.stylesheet = stylesheet; } internal void AddTemplate(TemplateAction template) { Debug.Assert(template != null); Debug.Assert( ((object) this.mode == (object) template.Mode) || (template.Mode == null && this.mode.Equals(XmlQualifiedName.Empty)) || this.mode.Equals(template.Mode) ); if (this.templates == null) { this.templates = new ArrayList(); } this.templates.Add(template); } internal void ProcessTemplates() { if (this.templates != null) { this.templates.Sort(s_TemplateComparer); } } internal TemplateAction FindTemplate(Processor processor, XPathNavigator navigator) { if (this.templates == null) { return null; } Debug.Assert(this.templates != null); for (int templateIndex = this.templates.Count - 1; templateIndex >= 0 ; templateIndex --) { TemplateAction action = (TemplateAction) this.templates[templateIndex]; int matchKey = action.MatchKey; if (matchKey != Compiler.InvalidQueryKey) { if (processor.Matches(navigator, matchKey)) { return action; } } } return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CustomExpression.cs
- UnderstoodHeaders.cs
- WindowsSlider.cs
- TraceRecord.cs
- Calendar.cs
- ParseChildrenAsPropertiesAttribute.cs
- Typography.cs
- Context.cs
- OdbcRowUpdatingEvent.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- _UriTypeConverter.cs
- EntityDescriptor.cs
- PnrpPermission.cs
- TableSectionStyle.cs
- NoClickablePointException.cs
- XsltSettings.cs
- DataRowChangeEvent.cs
- InputScopeManager.cs
- Random.cs
- Point3D.cs
- SqlReorderer.cs
- TransformCollection.cs
- ErrorsHelper.cs
- WindowsFormsSynchronizationContext.cs
- mediapermission.cs
- NetNamedPipeSecurityElement.cs
- RSACryptoServiceProvider.cs
- DataGridViewColumn.cs
- QueryCacheEntry.cs
- RegularExpressionValidator.cs
- ExtensionElementCollection.cs
- ProcessRequestAsyncResult.cs
- MarkupCompiler.cs
- CqlParser.cs
- XmlWriterSettings.cs
- CollectionViewProxy.cs
- ToolboxItem.cs
- XpsSerializationManager.cs
- CodeDesigner.cs
- ConnectionManagementElement.cs
- DrawingContextDrawingContextWalker.cs
- CategoryNameCollection.cs
- TextEffectResolver.cs
- Simplifier.cs
- PublisherIdentityPermission.cs
- SeverityFilter.cs
- FileUtil.cs
- Menu.cs
- Calendar.cs
- FileAuthorizationModule.cs
- RuntimeHelpers.cs
- StrokeSerializer.cs
- TextParentUndoUnit.cs
- TabControlEvent.cs
- SizeF.cs
- ConfigurationException.cs
- base64Transforms.cs
- ScriptControl.cs
- ConstructorBuilder.cs
- AssemblyCollection.cs
- ScheduleChanges.cs
- TimeZoneInfo.cs
- OneOf.cs
- ButtonChrome.cs
- SecurityUtils.cs
- InternalConfigRoot.cs
- sqlstateclientmanager.cs
- Activity.cs
- hebrewshape.cs
- CngProperty.cs
- ObjectToIdCache.cs
- XmlSiteMapProvider.cs
- OrCondition.cs
- XmlUTF8TextWriter.cs
- UnsupportedPolicyOptionsException.cs
- ProtocolImporter.cs
- CodeNamespace.cs
- AuthorizationRuleCollection.cs
- EncryptedXml.cs
- ValueType.cs
- Encoder.cs
- ValueType.cs
- XmlRawWriter.cs
- BindingSource.cs
- Ops.cs
- FontSizeConverter.cs
- PhoneCall.cs
- OracleNumber.cs
- MessagePartDescriptionCollection.cs
- TaskFileService.cs
- ToolStripItemImageRenderEventArgs.cs
- Pair.cs
- DataMemberConverter.cs
- Block.cs
- AffineTransform3D.cs
- StateDesigner.LayoutSelectionGlyph.cs
- PropertyChangedEventArgs.cs
- DetailsViewRowCollection.cs
- ToolStripDropTargetManager.cs
- TextBoxView.cs