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
- EUCJPEncoding.cs
- AnonymousIdentificationModule.cs
- CallInfo.cs
- Binding.cs
- Rect.cs
- thaishape.cs
- ConfigurationLocationCollection.cs
- InitializationEventAttribute.cs
- HashRepartitionEnumerator.cs
- Misc.cs
- XPathExpr.cs
- BooleanExpr.cs
- SchemaMapping.cs
- PixelShader.cs
- SchemaCollectionPreprocessor.cs
- DataGridViewDataErrorEventArgs.cs
- SQLBytesStorage.cs
- VSDExceptions.cs
- MenuItemAutomationPeer.cs
- ResolveMatchesApril2005.cs
- BaseProcessor.cs
- Utils.cs
- MiniAssembly.cs
- NominalTypeEliminator.cs
- MatrixAnimationUsingKeyFrames.cs
- TransformationRules.cs
- ContainerSelectorGlyph.cs
- GenericTypeParameterBuilder.cs
- BitmapSourceSafeMILHandle.cs
- SqlCaseSimplifier.cs
- Convert.cs
- MissingManifestResourceException.cs
- PerformanceCounterManager.cs
- EventDescriptor.cs
- LayoutDump.cs
- ViewPort3D.cs
- DocumentOrderQuery.cs
- DataMemberFieldConverter.cs
- SqlCacheDependencyDatabaseCollection.cs
- SchemaLookupTable.cs
- Missing.cs
- MenuStrip.cs
- GcHandle.cs
- InvalidComObjectException.cs
- TypeConverter.cs
- BoundField.cs
- DataGridPreparingCellForEditEventArgs.cs
- UrlParameterWriter.cs
- PointConverter.cs
- CharacterString.cs
- InvalidOleVariantTypeException.cs
- WebBrowserNavigatingEventHandler.cs
- MemberMaps.cs
- AxisAngleRotation3D.cs
- Panel.cs
- ArrayWithOffset.cs
- Attributes.cs
- ObjectDataSourceDisposingEventArgs.cs
- HuffCodec.cs
- ListInitExpression.cs
- ObjectListFieldsPage.cs
- FormViewInsertedEventArgs.cs
- ContentElementAutomationPeer.cs
- WindowsFormsSynchronizationContext.cs
- Transactions.cs
- CloseCollectionAsyncResult.cs
- DockingAttribute.cs
- StoreConnection.cs
- RuntimeWrappedException.cs
- DllNotFoundException.cs
- PrinterUnitConvert.cs
- ProcessModelSection.cs
- DataTablePropertyDescriptor.cs
- ListItem.cs
- EventMap.cs
- CodeSpit.cs
- WebPartChrome.cs
- HybridDictionary.cs
- IntSecurity.cs
- Point3D.cs
- OdbcConnectionString.cs
- MatchAttribute.cs
- SmtpFailedRecipientsException.cs
- WebPartChrome.cs
- AtomicFile.cs
- DefaultTraceListener.cs
- WebDescriptionAttribute.cs
- SoapSchemaImporter.cs
- EdmScalarPropertyAttribute.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- VectorKeyFrameCollection.cs
- UniqueSet.cs
- ScriptResourceHandler.cs
- SqlExpander.cs
- CodeNamespace.cs
- BinHexEncoder.cs
- UiaCoreTypesApi.cs
- DateTimeStorage.cs
- SamlConstants.cs
- safex509handles.cs