Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AttributeQuery.cs
- EventWaitHandle.cs
- PartitionedStream.cs
- DynamicObjectAccessor.cs
- ParsedAttributeCollection.cs
- MembershipUser.cs
- WindowsSysHeader.cs
- TrimSurroundingWhitespaceAttribute.cs
- ListGeneralPage.cs
- HMAC.cs
- AnnotationElement.cs
- _SslState.cs
- SortFieldComparer.cs
- PresentationAppDomainManager.cs
- ScrollProperties.cs
- StyleXamlParser.cs
- GAC.cs
- SynchronizationContext.cs
- SpeechAudioFormatInfo.cs
- TreeNodeMouseHoverEvent.cs
- CheckBox.cs
- IntersectQueryOperator.cs
- DebugInfoGenerator.cs
- Tuple.cs
- TextEditorCharacters.cs
- InternalResources.cs
- Form.cs
- ClientUriBehavior.cs
- XmlSortKeyAccumulator.cs
- RewritingSimplifier.cs
- XmlILIndex.cs
- PrinterResolution.cs
- Repeater.cs
- SoapIgnoreAttribute.cs
- ChineseLunisolarCalendar.cs
- XmlSchemaSimpleContentExtension.cs
- GridViewPageEventArgs.cs
- ConnectionsZone.cs
- RegexParser.cs
- DummyDataSource.cs
- DeviceSpecificDesigner.cs
- QilInvokeEarlyBound.cs
- SchemaTypeEmitter.cs
- HelpEvent.cs
- bidPrivateBase.cs
- StatusBarItem.cs
- ExpandCollapseIsCheckedConverter.cs
- SymmetricKey.cs
- DataGridViewCellPaintingEventArgs.cs
- Visual3DCollection.cs
- SymbolEqualComparer.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- WebPartTransformerCollection.cs
- MachineSettingsSection.cs
- OdbcEnvironment.cs
- IDictionary.cs
- InternalMappingException.cs
- CurrentTimeZone.cs
- CodeExporter.cs
- MTConfigUtil.cs
- ComplexType.cs
- FileDialogCustomPlace.cs
- SchemaTypeEmitter.cs
- VScrollProperties.cs
- SqlReferenceCollection.cs
- FixUpCollection.cs
- FieldBuilder.cs
- GeneralTransform.cs
- SqlBuilder.cs
- DataGridBeginningEditEventArgs.cs
- IOException.cs
- CompositionAdorner.cs
- DocumentSchemaValidator.cs
- ReadOnlyTernaryTree.cs
- Error.cs
- SqlParameterCollection.cs
- PersonalizationAdministration.cs
- ClientTarget.cs
- CollectionBase.cs
- TableSectionStyle.cs
- WindowsSpinner.cs
- SqlTopReducer.cs
- ContourSegment.cs
- KeyFrames.cs
- EventPropertyMap.cs
- TabControlEvent.cs
- FileVersionInfo.cs
- GenericWebPart.cs
- TiffBitmapEncoder.cs
- ObjectComplexPropertyMapping.cs
- CommentEmitter.cs
- RadioButtonRenderer.cs
- IdentityNotMappedException.cs
- PointValueSerializer.cs
- TabControlAutomationPeer.cs
- ItemCollectionEditor.cs
- WebPartDisplayMode.cs
- TextSpan.cs
- CombinedGeometry.cs
- CodeTypeReferenceExpression.cs