Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Xml / System / Xml / schema / SchemaAttDef.cs / 1 / SchemaAttDef.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Schema { using System.Diagnostics; /* * 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 { public enum Reserve { None, XmlSpace, XmlLang }; private Reserve reserved; // indicate the attribute type, such as xml:lang or xml:space private String defExpanded; // default value in its expanded form private bool hasEntityRef; // whether there is any entity reference in the default value XmlSchemaAttribute schemaAttribute; private bool defaultValueChecked; int lineNum; int linePos; int valueLineNum; int valueLinePos; public static readonly SchemaAttDef Empty = new SchemaAttDef(); public SchemaAttDef(XmlQualifiedName name, String prefix) : base(name, prefix) { reserved = Reserve.None; } private SchemaAttDef() {} public SchemaAttDef Clone() { return (SchemaAttDef) MemberwiseClone(); } internal int LinePos { get { return linePos; } set { linePos = value; } } internal int LineNum { get { return lineNum; } set { lineNum = value; } } internal int ValueLinePos { get { return valueLinePos; } set { valueLinePos = value; } } internal int ValueLineNum { get { return valueLineNum; } set { valueLineNum = value; } } internal bool DefaultValueChecked { get { return defaultValueChecked; } } public String DefaultValueExpanded { get { return(defExpanded != null) ? defExpanded : String.Empty;} set { defExpanded = value;} } public Reserve Reserved { get { return reserved;} set { reserved = value;} } public bool HasEntityRef { get { return hasEntityRef;} set { hasEntityRef = value;} } public XmlSchemaAttribute SchemaAttribute { get { return schemaAttribute; } set { schemaAttribute = value; } } public void CheckXmlSpace(ValidationEventHandler eventhandler) { 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; } } } eventhandler(this, new ValidationEventArgs(new XmlSchemaException(Res.Sch_XmlSpace, string.Empty))); } internal void CheckDefaultValue( SchemaInfo schemaInfo, IDtdParserAdapter readerAdapter ) { DtdValidator.CheckDefaultValue( this, schemaInfo, readerAdapter ); defaultValueChecked = true; } } } // 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; /* * 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 { public enum Reserve { None, XmlSpace, XmlLang }; private Reserve reserved; // indicate the attribute type, such as xml:lang or xml:space private String defExpanded; // default value in its expanded form private bool hasEntityRef; // whether there is any entity reference in the default value XmlSchemaAttribute schemaAttribute; private bool defaultValueChecked; int lineNum; int linePos; int valueLineNum; int valueLinePos; public static readonly SchemaAttDef Empty = new SchemaAttDef(); public SchemaAttDef(XmlQualifiedName name, String prefix) : base(name, prefix) { reserved = Reserve.None; } private SchemaAttDef() {} public SchemaAttDef Clone() { return (SchemaAttDef) MemberwiseClone(); } internal int LinePos { get { return linePos; } set { linePos = value; } } internal int LineNum { get { return lineNum; } set { lineNum = value; } } internal int ValueLinePos { get { return valueLinePos; } set { valueLinePos = value; } } internal int ValueLineNum { get { return valueLineNum; } set { valueLineNum = value; } } internal bool DefaultValueChecked { get { return defaultValueChecked; } } public String DefaultValueExpanded { get { return(defExpanded != null) ? defExpanded : String.Empty;} set { defExpanded = value;} } public Reserve Reserved { get { return reserved;} set { reserved = value;} } public bool HasEntityRef { get { return hasEntityRef;} set { hasEntityRef = value;} } public XmlSchemaAttribute SchemaAttribute { get { return schemaAttribute; } set { schemaAttribute = value; } } public void CheckXmlSpace(ValidationEventHandler eventhandler) { 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; } } } eventhandler(this, new ValidationEventArgs(new XmlSchemaException(Res.Sch_XmlSpace, string.Empty))); } internal void CheckDefaultValue( SchemaInfo schemaInfo, IDtdParserAdapter readerAdapter ) { DtdValidator.CheckDefaultValue( this, schemaInfo, readerAdapter ); defaultValueChecked = true; } } } // 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
- InitiatorSessionSymmetricTransportSecurityProtocol.cs
- Stylus.cs
- RoleService.cs
- CustomAttributeBuilder.cs
- ProjectionNode.cs
- ConnectivityStatus.cs
- safex509handles.cs
- TickBar.cs
- PngBitmapEncoder.cs
- ProgressBarBrushConverter.cs
- JavascriptXmlWriterWrapper.cs
- FormatVersion.cs
- Dictionary.cs
- FieldNameLookup.cs
- ComponentResourceKeyConverter.cs
- StringResourceManager.cs
- DataRecordInfo.cs
- OrderedDictionaryStateHelper.cs
- SelectedGridItemChangedEvent.cs
- XmlNamespaceMapping.cs
- RemotingServices.cs
- DateTimePickerDesigner.cs
- BeginGetFileNameFromUserRequest.cs
- HebrewCalendar.cs
- TextRangeProviderWrapper.cs
- ObjectDataSourceStatusEventArgs.cs
- GenericAuthenticationEventArgs.cs
- WebBrowserNavigatedEventHandler.cs
- QilTypeChecker.cs
- FontStretchConverter.cs
- EntityDataSourceDesignerHelper.cs
- ValidationRule.cs
- BitmapEffectDrawingContextWalker.cs
- BaseComponentEditor.cs
- SafeCryptContextHandle.cs
- SpeechEvent.cs
- OleDbCommand.cs
- ButtonField.cs
- SoapFormatExtensions.cs
- TextFormatter.cs
- RegexGroup.cs
- PasswordTextContainer.cs
- TableRow.cs
- HtmlInputPassword.cs
- AnnouncementEndpoint.cs
- StorageFunctionMapping.cs
- File.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- LinqDataSourceSelectEventArgs.cs
- AppDomain.cs
- CompoundFileIOPermission.cs
- Expander.cs
- VerticalConnector.xaml.cs
- VerificationException.cs
- BitSet.cs
- SignatureHelper.cs
- TransformProviderWrapper.cs
- DataRowView.cs
- StrongTypingException.cs
- ZipIOExtraField.cs
- TextTreeTextElementNode.cs
- EditorPart.cs
- NameSpaceExtractor.cs
- HTTPNotFoundHandler.cs
- InkCanvasSelection.cs
- DataServiceCollectionOfT.cs
- UiaCoreApi.cs
- RangeBase.cs
- SystemIcons.cs
- ErasingStroke.cs
- PlaceHolder.cs
- ProtocolViolationException.cs
- DataSourceControl.cs
- ApplicationServiceHelper.cs
- ProviderSettings.cs
- DeferredBinaryDeserializerExtension.cs
- DesignUtil.cs
- RotationValidation.cs
- XPathParser.cs
- TdsParserStateObject.cs
- KeysConverter.cs
- Path.cs
- RowBinding.cs
- ControlEvent.cs
- UIntPtr.cs
- TextContainerHelper.cs
- elementinformation.cs
- SystemIcmpV6Statistics.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- TransformProviderWrapper.cs
- XsdBuilder.cs
- GifBitmapDecoder.cs
- BaseInfoTable.cs
- HwndSourceKeyboardInputSite.cs
- CursorInteropHelper.cs
- odbcmetadatacollectionnames.cs
- ToolboxBitmapAttribute.cs
- TableParagraph.cs
- Int32Collection.cs
- CommonXSendMessage.cs