Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / XmlDocumentViewSchema.cs / 1 / XmlDocumentViewSchema.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design { using System.Collections; using System.Collections.Specialized; using System.Diagnostics; using System.Xml; using System.Xml.XPath; ////// A class to expose hierarchical schema from an XmlDocument object. /// This is used by data source designers to enable data-bound to /// traverse their schema at design time. /// internal sealed class XmlDocumentViewSchema : IDataSourceViewSchema { private string _name; private OrderedDictionary _children; private ArrayList _attrs; private IDataSourceViewSchema[] _viewSchemas; private IDataSourceFieldSchema[] _fieldSchemas; private bool _includeSpecialSchema; public XmlDocumentViewSchema(string name, Pair data, bool includeSpecialSchema) { _includeSpecialSchema = includeSpecialSchema; Debug.Assert(name != null && name.Length > 0); Debug.Assert(data != null); _children = (OrderedDictionary)data.First; Debug.Assert(_children != null); _attrs = (ArrayList)data.Second; Debug.Assert(_attrs != null); _name = name; } public string Name { get { return _name; } } public IDataSourceViewSchema[] GetChildren() { if (_viewSchemas == null) { _viewSchemas = new IDataSourceViewSchema[_children.Count]; int i = 0; foreach (DictionaryEntry de in _children) { _viewSchemas[i] = new XmlDocumentViewSchema((string)de.Key, (Pair)de.Value, _includeSpecialSchema); i++; } } return _viewSchemas; } public IDataSourceFieldSchema[] GetFields() { if (_fieldSchemas == null) { // The three extra slots are for the "special" field names int specialSchemaCount = (_includeSpecialSchema ? 3 : 0); _fieldSchemas = new IDataSourceFieldSchema[_attrs.Count + specialSchemaCount]; if (_includeSpecialSchema) { _fieldSchemas[0] = new XmlDocumentFieldSchema("#Name"); _fieldSchemas[1] = new XmlDocumentFieldSchema("#Value"); _fieldSchemas[2] = new XmlDocumentFieldSchema("#InnerText"); } for (int i = 0; i < _attrs.Count; i++) { _fieldSchemas[i + specialSchemaCount] = new XmlDocumentFieldSchema((string)_attrs[i]); } } return _fieldSchemas; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataKey.cs
- PassportPrincipal.cs
- TimerEventSubscriptionCollection.cs
- EntityDataSourceView.cs
- TextComposition.cs
- TraceProvider.cs
- X509DefaultServiceCertificateElement.cs
- TextContainerChangedEventArgs.cs
- SafeHandles.cs
- DeclaredTypeValidatorAttribute.cs
- Size3DConverter.cs
- ProtectedConfigurationSection.cs
- PackWebRequestFactory.cs
- TaiwanCalendar.cs
- FlowDocumentReader.cs
- EnumDataContract.cs
- PagesChangedEventArgs.cs
- MD5.cs
- ValueUnavailableException.cs
- EffectiveValueEntry.cs
- ContextStack.cs
- RelationshipNavigation.cs
- StateRuntime.cs
- BindingNavigator.cs
- SchemaImporter.cs
- Translator.cs
- Int64Converter.cs
- OptionUsage.cs
- Listbox.cs
- HttpResponseHeader.cs
- AuthorizationBehavior.cs
- ContentTextAutomationPeer.cs
- TdsParserHelperClasses.cs
- BitArray.cs
- filewebresponse.cs
- ReadContentAsBinaryHelper.cs
- MessageQueueCriteria.cs
- UnderstoodHeaders.cs
- ResourceAssociationSet.cs
- ManagementEventWatcher.cs
- MembershipSection.cs
- InstanceHandle.cs
- RC2CryptoServiceProvider.cs
- Crypto.cs
- DispatcherHookEventArgs.cs
- HostedController.cs
- ButtonField.cs
- WSHttpBinding.cs
- UnitControl.cs
- TemplateParser.cs
- IndependentlyAnimatedPropertyMetadata.cs
- wmiprovider.cs
- TreeViewImageIndexConverter.cs
- ErrorsHelper.cs
- UTF8Encoding.cs
- SocketInformation.cs
- PkcsUtils.cs
- DataColumn.cs
- TimeSpanMinutesConverter.cs
- GlyphTypeface.cs
- LayoutUtils.cs
- ToolStripRenderer.cs
- SchemaCollectionCompiler.cs
- Utility.cs
- GlobalizationSection.cs
- InvalidOperationException.cs
- ProtocolImporter.cs
- PerformanceCounterPermission.cs
- FileChangesMonitor.cs
- Size.cs
- PriorityItem.cs
- EntityViewGenerator.cs
- Camera.cs
- AnnotationResource.cs
- OdbcParameterCollection.cs
- TextDocumentView.cs
- UpdateException.cs
- TreeChangeInfo.cs
- SiteMapNodeItem.cs
- FlatButtonAppearance.cs
- FontFamilyValueSerializer.cs
- JsonXmlDataContract.cs
- ByteFacetDescriptionElement.cs
- Pool.cs
- RtfToXamlLexer.cs
- Operators.cs
- ClonableStack.cs
- SimpleRecyclingCache.cs
- NavigationHelper.cs
- StreamUpdate.cs
- HandoffBehavior.cs
- ListenerTraceUtility.cs
- ToolStripControlHost.cs
- Unit.cs
- InfoCardArgumentException.cs
- ReadOnlyHierarchicalDataSource.cs
- DragSelectionMessageFilter.cs
- ZipIOExtraFieldElement.cs
- ResourcePermissionBaseEntry.cs
- ViewEvent.cs