Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / CompiledAction.cs / 1305376 / CompiledAction.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 abstract class CompiledAction : Action { internal abstract void Compile(Compiler compiler); internal virtual bool CompileAttribute(Compiler compiler) { return false; } public void CompileAttributes(Compiler compiler) { NavigatorInput input = compiler.Input; string element = input.LocalName; if (input.MoveToFirstAttribute()) { do { if (input.NamespaceURI.Length != 0) continue; try { if (CompileAttribute(compiler) == false) { throw XsltException.Create(Res.Xslt_InvalidAttribute, input.LocalName, element); } }catch { if (! compiler.ForwardCompatibility) { throw; } else { // In ForwardCompatibility mode we ignoreing all unknown or incorrect attributes // If it's mandatory attribute we'l notice it absents later. } } } while (input.MoveToNextAttribute()); input.ToParent(); } } // For perf reason we precalculating AVTs at compile time. // If we can do this we set original AVT to null internal static string PrecalculateAvt(ref Avt avt) { string result = null; if(avt != null && avt.IsConstant) { result = avt.Evaluate(null, null); avt = null; } return result; } public void CheckEmpty(Compiler compiler) { // Really EMPTY means no content at all, but the sake of compatibility with MSXML we allow whitespaces string elementName = compiler.Input.Name; if (compiler.Recurse()) { do { // Note: will be reported as XPathNodeType.Text XPathNodeType nodeType = compiler.Input.NodeType; if ( nodeType != XPathNodeType.Whitespace && nodeType != XPathNodeType.Comment && nodeType != XPathNodeType.ProcessingInstruction ) { throw XsltException.Create(Res.Xslt_NotEmptyContents, elementName); } } while (compiler.Advance()); compiler.ToParent(); } } public void CheckRequiredAttribute(Compiler compiler, object attrValue, string attrName) { CheckRequiredAttribute(compiler, attrValue != null, attrName); } public void CheckRequiredAttribute(Compiler compiler, bool attr, string attrName) { if (! attr) { throw XsltException.Create(Res.Xslt_MissingAttribute, attrName); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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 abstract class CompiledAction : Action { internal abstract void Compile(Compiler compiler); internal virtual bool CompileAttribute(Compiler compiler) { return false; } public void CompileAttributes(Compiler compiler) { NavigatorInput input = compiler.Input; string element = input.LocalName; if (input.MoveToFirstAttribute()) { do { if (input.NamespaceURI.Length != 0) continue; try { if (CompileAttribute(compiler) == false) { throw XsltException.Create(Res.Xslt_InvalidAttribute, input.LocalName, element); } }catch { if (! compiler.ForwardCompatibility) { throw; } else { // In ForwardCompatibility mode we ignoreing all unknown or incorrect attributes // If it's mandatory attribute we'l notice it absents later. } } } while (input.MoveToNextAttribute()); input.ToParent(); } } // For perf reason we precalculating AVTs at compile time. // If we can do this we set original AVT to null internal static string PrecalculateAvt(ref Avt avt) { string result = null; if(avt != null && avt.IsConstant) { result = avt.Evaluate(null, null); avt = null; } return result; } public void CheckEmpty(Compiler compiler) { // Really EMPTY means no content at all, but the sake of compatibility with MSXML we allow whitespaces string elementName = compiler.Input.Name; if (compiler.Recurse()) { do { // Note: will be reported as XPathNodeType.Text XPathNodeType nodeType = compiler.Input.NodeType; if ( nodeType != XPathNodeType.Whitespace && nodeType != XPathNodeType.Comment && nodeType != XPathNodeType.ProcessingInstruction ) { throw XsltException.Create(Res.Xslt_NotEmptyContents, elementName); } } while (compiler.Advance()); compiler.ToParent(); } } public void CheckRequiredAttribute(Compiler compiler, object attrValue, string attrName) { CheckRequiredAttribute(compiler, attrValue != null, attrName); } public void CheckRequiredAttribute(Compiler compiler, bool attr, string attrName) { if (! attr) { throw XsltException.Create(Res.Xslt_MissingAttribute, attrName); } } } } // 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
- HierarchicalDataBoundControl.cs
- NamedPipeProcessProtocolHandler.cs
- GradientStop.cs
- LinqDataSourceDeleteEventArgs.cs
- AttributeExtensions.cs
- SrgsElementList.cs
- CatalogPartChrome.cs
- ObjectAssociationEndMapping.cs
- CaseCqlBlock.cs
- ConfigurationValidatorBase.cs
- codemethodreferenceexpression.cs
- CommandField.cs
- TypedDataSetSchemaImporterExtension.cs
- MarginCollapsingState.cs
- WebEncodingValidatorAttribute.cs
- UnsafeNativeMethods.cs
- GeneralTransform3DTo2D.cs
- storepermissionattribute.cs
- FirstMatchCodeGroup.cs
- ClientTarget.cs
- StringBuilder.cs
- PropertyMetadata.cs
- MimeAnyImporter.cs
- MdbDataFileEditor.cs
- Vector3D.cs
- FontStyles.cs
- QilGenerator.cs
- InternalTypeHelper.cs
- ExpressionBuilder.cs
- PageThemeCodeDomTreeGenerator.cs
- TerminateDesigner.cs
- CharAnimationUsingKeyFrames.cs
- PerformanceCounterPermissionAttribute.cs
- ServiceAuthorizationBehavior.cs
- Policy.cs
- MaskDesignerDialog.cs
- RequiredAttributeAttribute.cs
- PersonalizableAttribute.cs
- EditableLabelControl.cs
- OperandQuery.cs
- SendKeys.cs
- TextRangeBase.cs
- SoapAttributeAttribute.cs
- MemoryMappedFile.cs
- Point3DCollectionValueSerializer.cs
- DesignBindingValueUIHandler.cs
- ListViewEditEventArgs.cs
- RowVisual.cs
- SafeCryptHandles.cs
- ToolStripGrip.cs
- SingleObjectCollection.cs
- TypeLibConverter.cs
- CachedFontFace.cs
- Nullable.cs
- TextRangeEditTables.cs
- DefaultBindingPropertyAttribute.cs
- Keywords.cs
- BamlReader.cs
- HttpListenerException.cs
- SelectorAutomationPeer.cs
- TypedReference.cs
- SnapshotChangeTrackingStrategy.cs
- EditCommandColumn.cs
- CodeCompileUnit.cs
- XPathLexer.cs
- LoginAutoFormat.cs
- HostVisual.cs
- DispatchWrapper.cs
- FilterElement.cs
- DesignerAutoFormat.cs
- DataSourceCacheDurationConverter.cs
- ColorContext.cs
- TypeElement.cs
- UnsafeNativeMethods.cs
- ChildrenQuery.cs
- FieldBuilder.cs
- CompilerErrorCollection.cs
- Win32Interop.cs
- IList.cs
- SystemException.cs
- BuildProviderAppliesToAttribute.cs
- Variant.cs
- RightsManagementEncryptionTransform.cs
- UnaryNode.cs
- ProgressChangedEventArgs.cs
- WebPartEditorApplyVerb.cs
- EventMappingSettings.cs
- HeaderedContentControl.cs
- DependencyPropertyChangedEventArgs.cs
- mansign.cs
- TimerEventSubscriptionCollection.cs
- CodeDomConfigurationHandler.cs
- OptimizedTemplateContentHelper.cs
- embossbitmapeffect.cs
- TextContainerChangeEventArgs.cs
- HMACMD5.cs
- XmlSchemaCompilationSettings.cs
- SaveWorkflowAsyncResult.cs
- HijriCalendar.cs
- SignedPkcs7.cs