Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / InputScopeManager.cs / 1305376 / InputScopeManager.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; internal class InputScopeManager { private InputScope scopeStack; private string defaultNS = string.Empty; private XPathNavigator navigator; // We need this nsvigator for document() function implementation public InputScopeManager(XPathNavigator navigator, InputScope rootScope) { this.navigator = navigator; this.scopeStack = rootScope; } internal InputScope CurrentScope { get { return this.scopeStack; } } internal InputScope VariableScope { get { Debug.Assert(this.scopeStack != null); Debug.Assert(this.scopeStack.Parent != null); return this.scopeStack.Parent; } } internal InputScopeManager Clone() { InputScopeManager manager = new InputScopeManager(this.navigator, null); manager.scopeStack = this.scopeStack; manager.defaultNS = this.defaultNS; return manager; } public XPathNavigator Navigator { get {return this.navigator;} } internal InputScope PushScope() { this.scopeStack = new InputScope(this.scopeStack); return this.scopeStack; } internal void PopScope() { Debug.Assert(this.scopeStack != null, "Push/Pop disbalance"); if (this.scopeStack == null) { return; } for (NamespaceDecl scope = this.scopeStack.Scopes; scope != null; scope = scope.Next) { this.defaultNS = scope.PrevDefaultNsUri; } this.scopeStack = this.scopeStack.Parent; } internal void PushNamespace(string prefix, string nspace) { Debug.Assert(this.scopeStack != null, "PushScope wasn't called"); Debug.Assert(prefix != null); Debug.Assert(nspace != null); this.scopeStack.AddNamespace(prefix, nspace, this.defaultNS); if (prefix == null || prefix.Length == 0) { this.defaultNS = nspace; } } // CompileContext public string DefaultNamespace { get { return this.defaultNS; } } private string ResolveNonEmptyPrefix(string prefix) { Debug.Assert(this.scopeStack != null, "PushScope wasn't called"); Debug.Assert(prefix != null || prefix.Length != 0); if (prefix == "xml") { return XmlReservedNs.NsXml; } else if (prefix == "xmlns") { return XmlReservedNs.NsXmlNs; } for (InputScope inputScope = this.scopeStack; inputScope != null; inputScope = inputScope.Parent) { string nspace = inputScope.ResolveNonAtom(prefix); if (nspace != null) { return nspace; } } throw XsltException.Create(Res.Xslt_InvalidPrefix, prefix); } public string ResolveXmlNamespace(string prefix) { Debug.Assert(prefix != null); if (prefix.Length == 0) { return this.defaultNS; } return ResolveNonEmptyPrefix(prefix); } [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] public string ResolveXPathNamespace(string prefix) { Debug.Assert(prefix != null); if (prefix.Length == 0) { return string.Empty; } return ResolveNonEmptyPrefix(prefix); } internal void InsertExtensionNamespaces(string[] nsList) { Debug.Assert(this.scopeStack != null, "PushScope wasn't called"); Debug.Assert(nsList != null); for (int idx = 0; idx < nsList.Length; idx++) { this.scopeStack.InsertExtensionNamespace(nsList[idx]); } } internal bool IsExtensionNamespace(String nspace) { Debug.Assert(this.scopeStack != null, "PushScope wasn't called"); for (InputScope inputScope = this.scopeStack; inputScope != null; inputScope = inputScope.Parent) { if (inputScope.IsExtensionNamespace( nspace )) { return true; } } return false; } internal void InsertExcludedNamespaces(string[] nsList) { Debug.Assert(this.scopeStack != null, "PushScope wasn't called"); Debug.Assert(nsList != null); for (int idx = 0; idx < nsList.Length; idx++) { this.scopeStack.InsertExcludedNamespace(nsList[idx]); } } internal bool IsExcludedNamespace(String nspace) { Debug.Assert(this.scopeStack != null, "PushScope wasn't called"); for (InputScope inputScope = this.scopeStack; inputScope != null; inputScope = inputScope.Parent) { if (inputScope.IsExcludedNamespace( nspace )) { return true; } } return false; } } } // 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
- CodePageUtils.cs
- NameValueConfigurationElement.cs
- XmlDataSourceNodeDescriptor.cs
- EncoderFallback.cs
- DXD.cs
- UserNameSecurityTokenAuthenticator.cs
- DrawingVisualDrawingContext.cs
- ExpressionsCollectionEditor.cs
- GPPOINTF.cs
- ContentHostHelper.cs
- Stylus.cs
- SuppressMessageAttribute.cs
- KeyPullup.cs
- Literal.cs
- StringDictionary.cs
- DecoderFallbackWithFailureFlag.cs
- SiteMapNodeCollection.cs
- IdentityHolder.cs
- WindowsAuthenticationEventArgs.cs
- VariableDesigner.xaml.cs
- GridErrorDlg.cs
- _PooledStream.cs
- UshortList2.cs
- NameTable.cs
- DataRowCollection.cs
- ProxyHwnd.cs
- BinaryNode.cs
- SizeConverter.cs
- ContractMapping.cs
- PrimaryKeyTypeConverter.cs
- PassportAuthenticationModule.cs
- SourceLineInfo.cs
- ChangeDirector.cs
- TaskFileService.cs
- PersonalizableTypeEntry.cs
- Scheduler.cs
- ConnectionStringsExpressionEditor.cs
- ConstrainedDataObject.cs
- _BufferOffsetSize.cs
- SiteMapDataSourceView.cs
- ContainsRowNumberChecker.cs
- Token.cs
- HtmlInputText.cs
- PropertyGrid.cs
- BamlVersionHeader.cs
- SystemIPAddressInformation.cs
- HttpPostLocalhostServerProtocol.cs
- HttpListenerException.cs
- ToolboxBitmapAttribute.cs
- NumberAction.cs
- WebRequest.cs
- UnsafeNativeMethods.cs
- AstTree.cs
- Win32PrintDialog.cs
- LoginStatusDesigner.cs
- QilFunction.cs
- XmlSerializerAssemblyAttribute.cs
- Matrix3D.cs
- BigInt.cs
- ConstantProjectedSlot.cs
- _SslStream.cs
- TryLoadRunnableWorkflowCommand.cs
- ZipIOLocalFileBlock.cs
- FtpWebResponse.cs
- ResolveCriteria11.cs
- InProcStateClientManager.cs
- HotSpot.cs
- ColorIndependentAnimationStorage.cs
- TextElement.cs
- Events.cs
- UnicastIPAddressInformationCollection.cs
- CounterSample.cs
- SQLMembershipProvider.cs
- CreateUserWizardStep.cs
- URLMembershipCondition.cs
- SecurityPolicySection.cs
- QilName.cs
- RSAPKCS1KeyExchangeFormatter.cs
- WorkflowWebHostingModule.cs
- SubpageParaClient.cs
- ProcessHostMapPath.cs
- FontNamesConverter.cs
- WebSysDescriptionAttribute.cs
- BitmapEffectGeneralTransform.cs
- CheckBoxList.cs
- StopStoryboard.cs
- PointUtil.cs
- SchemaConstraints.cs
- CancellationHandlerDesigner.cs
- CngAlgorithm.cs
- SrgsSemanticInterpretationTag.cs
- SelectionUIService.cs
- XmlSchemaImport.cs
- CodeMemberMethod.cs
- ValueHandle.cs
- StatusBar.cs
- FontNamesConverter.cs
- datacache.cs
- FtpCachePolicyElement.cs
- StatusBarPanel.cs