Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / schema / SchemaAttDef.cs / 1305376 / SchemaAttDef.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Schema { using System.Diagnostics; using System.Collections.Generic; /* * This class describes an attribute type and potential values. * This encapsulates the information for one Attdef * in an * Attlist in a DTD as described below: */ internal sealed class SchemaAttDef : SchemaDeclBase, IDtdDefaultAttributeInfo { internal enum Reserve { None, XmlSpace, XmlLang }; private String defExpanded; // default value in its expanded form int lineNum; int linePos; int valueLineNum; int valueLinePos; private Reserve reserved = Reserve.None; // indicate the attribute type, such as xml:lang or xml:space #if SILVERLIGHT XmlTokenizedType tokenizedType; #endif #if !SILVERLIGHT private bool defaultValueChecked; private bool hasEntityRef; // whether there is any entity reference in the default value XmlSchemaAttribute schemaAttribute; public static readonly SchemaAttDef Empty = new SchemaAttDef(); #endif // // Constructors // public SchemaAttDef(XmlQualifiedName name, String prefix) : base(name, prefix) { } #if !SILVERLIGHT public SchemaAttDef(XmlQualifiedName name) : base(name, null) { } private SchemaAttDef() {} #endif // // IDtdAttributeInfo interface // #region IDtdAttributeInfo Members string IDtdAttributeInfo.Prefix { get { return ((SchemaAttDef)this).Prefix; } } string IDtdAttributeInfo.LocalName { get { return ((SchemaAttDef)this).Name.Name; } } int IDtdAttributeInfo.LineNumber { get { return ((SchemaAttDef)this).LineNumber; } } int IDtdAttributeInfo.LinePosition { get { return ((SchemaAttDef)this).LinePosition; } } bool IDtdAttributeInfo.IsNonCDataType { get { return this.TokenizedType != XmlTokenizedType.CDATA; } } bool IDtdAttributeInfo.IsDeclaredInExternal { get { return ((SchemaAttDef)this).IsDeclaredInExternal; } } bool IDtdAttributeInfo.IsXmlAttribute { get { return this.Reserved != SchemaAttDef.Reserve.None; } } #endregion // // IDtdDefaultAttributeInfo interface // #region IDtdDefaultAttributeInfo Members string IDtdDefaultAttributeInfo.DefaultValueExpanded { get { return ((SchemaAttDef)this).DefaultValueExpanded; } } object IDtdDefaultAttributeInfo.DefaultValueTyped { #if SILVERLIGHT get { return null; } #else get { return ((SchemaAttDef)this).DefaultValueTyped; } #endif } int IDtdDefaultAttributeInfo.ValueLineNumber { get { return ((SchemaAttDef)this).ValueLineNumber; } } int IDtdDefaultAttributeInfo.ValueLinePosition { get { return ((SchemaAttDef)this).ValueLinePosition; } } #endregion // // Internal properties // internal int LinePosition { get { return linePos; } set { linePos = value; } } internal int LineNumber { get { return lineNum; } set { lineNum = value; } } internal int ValueLinePosition { get { return valueLinePos; } set { valueLinePos = value; } } internal int ValueLineNumber { get { return valueLineNum; } set { valueLineNum = value; } } internal String DefaultValueExpanded { get { return(defExpanded != null) ? defExpanded : String.Empty;} set { defExpanded = value;} } internal XmlTokenizedType TokenizedType { get { #if SILVERLIGHT return tokenizedType; #else return Datatype.TokenizedType; #endif } set { #if SILVERLIGHT tokenizedType = value; #else this.Datatype = XmlSchemaDatatype.FromXmlTokenizedType(value); #endif } } internal Reserve Reserved { get { return reserved;} set { reserved = value;} } #if !SILVERLIGHT internal bool DefaultValueChecked { get { return defaultValueChecked; } } internal bool HasEntityRef { get { return hasEntityRef;} set { hasEntityRef = value;} } internal XmlSchemaAttribute SchemaAttribute { get { return schemaAttribute; } set { schemaAttribute = value; } } internal void CheckXmlSpace(IValidationEventHandling validationEventHandling) { if (datatype.TokenizedType == XmlTokenizedType.ENUMERATION && (values != null) && (values.Count <= 2)) { String s1 = values[0].ToString(); if (values.Count == 2) { String s2 = values[1].ToString(); if ((s1 == "default" || s2 == "default") && (s1 == "preserve" || s2 == "preserve")) { return; } } else { if (s1 == "default" || s1 == "preserve") { return; } } } validationEventHandling.SendEvent(new XmlSchemaException(Res.Sch_XmlSpace, string.Empty), XmlSeverityType.Error); } internal SchemaAttDef Clone() { return (SchemaAttDef) MemberwiseClone(); } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Schema { using System.Diagnostics; using System.Collections.Generic; /* * This class describes an attribute type and potential values. * This encapsulates the information for one Attdef * in an * Attlist in a DTD as described below: */ internal sealed class SchemaAttDef : SchemaDeclBase, IDtdDefaultAttributeInfo { internal enum Reserve { None, XmlSpace, XmlLang }; private String defExpanded; // default value in its expanded form int lineNum; int linePos; int valueLineNum; int valueLinePos; private Reserve reserved = Reserve.None; // indicate the attribute type, such as xml:lang or xml:space #if SILVERLIGHT XmlTokenizedType tokenizedType; #endif #if !SILVERLIGHT private bool defaultValueChecked; private bool hasEntityRef; // whether there is any entity reference in the default value XmlSchemaAttribute schemaAttribute; public static readonly SchemaAttDef Empty = new SchemaAttDef(); #endif // // Constructors // public SchemaAttDef(XmlQualifiedName name, String prefix) : base(name, prefix) { } #if !SILVERLIGHT public SchemaAttDef(XmlQualifiedName name) : base(name, null) { } private SchemaAttDef() {} #endif // // IDtdAttributeInfo interface // #region IDtdAttributeInfo Members string IDtdAttributeInfo.Prefix { get { return ((SchemaAttDef)this).Prefix; } } string IDtdAttributeInfo.LocalName { get { return ((SchemaAttDef)this).Name.Name; } } int IDtdAttributeInfo.LineNumber { get { return ((SchemaAttDef)this).LineNumber; } } int IDtdAttributeInfo.LinePosition { get { return ((SchemaAttDef)this).LinePosition; } } bool IDtdAttributeInfo.IsNonCDataType { get { return this.TokenizedType != XmlTokenizedType.CDATA; } } bool IDtdAttributeInfo.IsDeclaredInExternal { get { return ((SchemaAttDef)this).IsDeclaredInExternal; } } bool IDtdAttributeInfo.IsXmlAttribute { get { return this.Reserved != SchemaAttDef.Reserve.None; } } #endregion // // IDtdDefaultAttributeInfo interface // #region IDtdDefaultAttributeInfo Members string IDtdDefaultAttributeInfo.DefaultValueExpanded { get { return ((SchemaAttDef)this).DefaultValueExpanded; } } object IDtdDefaultAttributeInfo.DefaultValueTyped { #if SILVERLIGHT get { return null; } #else get { return ((SchemaAttDef)this).DefaultValueTyped; } #endif } int IDtdDefaultAttributeInfo.ValueLineNumber { get { return ((SchemaAttDef)this).ValueLineNumber; } } int IDtdDefaultAttributeInfo.ValueLinePosition { get { return ((SchemaAttDef)this).ValueLinePosition; } } #endregion // // Internal properties // internal int LinePosition { get { return linePos; } set { linePos = value; } } internal int LineNumber { get { return lineNum; } set { lineNum = value; } } internal int ValueLinePosition { get { return valueLinePos; } set { valueLinePos = value; } } internal int ValueLineNumber { get { return valueLineNum; } set { valueLineNum = value; } } internal String DefaultValueExpanded { get { return(defExpanded != null) ? defExpanded : String.Empty;} set { defExpanded = value;} } internal XmlTokenizedType TokenizedType { get { #if SILVERLIGHT return tokenizedType; #else return Datatype.TokenizedType; #endif } set { #if SILVERLIGHT tokenizedType = value; #else this.Datatype = XmlSchemaDatatype.FromXmlTokenizedType(value); #endif } } internal Reserve Reserved { get { return reserved;} set { reserved = value;} } #if !SILVERLIGHT internal bool DefaultValueChecked { get { return defaultValueChecked; } } internal bool HasEntityRef { get { return hasEntityRef;} set { hasEntityRef = value;} } internal XmlSchemaAttribute SchemaAttribute { get { return schemaAttribute; } set { schemaAttribute = value; } } internal void CheckXmlSpace(IValidationEventHandling validationEventHandling) { if (datatype.TokenizedType == XmlTokenizedType.ENUMERATION && (values != null) && (values.Count <= 2)) { String s1 = values[0].ToString(); if (values.Count == 2) { String s2 = values[1].ToString(); if ((s1 == "default" || s2 == "default") && (s1 == "preserve" || s2 == "preserve")) { return; } } else { if (s1 == "default" || s1 == "preserve") { return; } } } validationEventHandling.SendEvent(new XmlSchemaException(Res.Sch_XmlSpace, string.Empty), XmlSeverityType.Error); } internal SchemaAttDef Clone() { return (SchemaAttDef) MemberwiseClone(); } #endif } } // 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
- TrackingProfile.cs
- SqlStream.cs
- HttpCapabilitiesEvaluator.cs
- ResourceDefaultValueAttribute.cs
- SchemaDeclBase.cs
- NavigationProperty.cs
- CanonicalXml.cs
- HierarchicalDataBoundControl.cs
- HttpListenerException.cs
- InstanceDescriptor.cs
- SingleResultAttribute.cs
- FormsAuthenticationConfiguration.cs
- ThreadInterruptedException.cs
- ZoneIdentityPermission.cs
- PeerServiceMessageContracts.cs
- WeakReferenceEnumerator.cs
- DataGridViewAdvancedBorderStyle.cs
- DataObjectFieldAttribute.cs
- MaterialGroup.cs
- DataGridViewColumnCollection.cs
- MonikerUtility.cs
- AttributeAction.cs
- SecurityContext.cs
- FrameworkContentElement.cs
- SQLResource.cs
- WindowsSpinner.cs
- URLMembershipCondition.cs
- DiagnosticsConfiguration.cs
- DataGridColumnCollectionEditor.cs
- IconHelper.cs
- NamespaceInfo.cs
- KernelTypeValidation.cs
- UserValidatedEventArgs.cs
- Util.cs
- CacheMode.cs
- CodeTypeDeclaration.cs
- CodeIndexerExpression.cs
- TextTrailingWordEllipsis.cs
- FaultPropagationQuery.cs
- EncoderReplacementFallback.cs
- WpfPayload.cs
- OdbcCommand.cs
- MonitoringDescriptionAttribute.cs
- TextDecorationCollection.cs
- ChineseLunisolarCalendar.cs
- SqlDataAdapter.cs
- SqlReferenceCollection.cs
- DataObjectAttribute.cs
- CodeNamespaceCollection.cs
- XmlSignatureProperties.cs
- TemplateEditingService.cs
- SerializationInfoEnumerator.cs
- ToolBarButtonClickEvent.cs
- PropertyState.cs
- HttpHandlerActionCollection.cs
- TextContainerHelper.cs
- ComponentDispatcherThread.cs
- TypeUtil.cs
- MouseCaptureWithinProperty.cs
- BitStack.cs
- SByte.cs
- RenderContext.cs
- OracleDataAdapter.cs
- HttpHandlerActionCollection.cs
- Util.cs
- CustomErrorsSectionWrapper.cs
- DbCommandDefinition.cs
- PerfCounterSection.cs
- ListViewDataItem.cs
- SessionPageStateSection.cs
- ControlCodeDomSerializer.cs
- SoapObjectWriter.cs
- RtfControlWordInfo.cs
- PackageFilter.cs
- SocketElement.cs
- WindowsAltTab.cs
- ServiceAuthorizationBehavior.cs
- DefaultValueTypeConverter.cs
- WindowsAltTab.cs
- WebScriptEnablingElement.cs
- SrgsText.cs
- BooleanKeyFrameCollection.cs
- EtwTrace.cs
- PackageRelationshipSelector.cs
- ClientApiGenerator.cs
- Material.cs
- MarkupCompiler.cs
- WhitespaceRuleLookup.cs
- BindingOperations.cs
- LambdaCompiler.Expressions.cs
- UndirectedGraph.cs
- Dispatcher.cs
- SystemColorTracker.cs
- FontFamilyConverter.cs
- TreeNode.cs
- LinearQuaternionKeyFrame.cs
- HtmlElement.cs
- Border.cs
- XsltInput.cs
- LingerOption.cs