Code:
/ FX-1434 / FX-1434 / 1.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
- BitmapEffectDrawing.cs
- ObjectQuery_EntitySqlExtensions.cs
- ValueTypeFixupInfo.cs
- fixedPageContentExtractor.cs
- CompModSwitches.cs
- HierarchicalDataSourceControl.cs
- SecurityTokenException.cs
- DefaultAuthorizationContext.cs
- LiteralDesigner.cs
- Currency.cs
- SymbolMethod.cs
- ClassicBorderDecorator.cs
- WebRequestModuleElementCollection.cs
- WindowsRichEdit.cs
- XmlDataImplementation.cs
- XmlSubtreeReader.cs
- HandlerFactoryCache.cs
- LayoutEditorPart.cs
- UserControlParser.cs
- SecurityCriticalDataForSet.cs
- XmlIlGenerator.cs
- BigInt.cs
- ColumnClickEvent.cs
- DataRowExtensions.cs
- TokenCreationParameter.cs
- EntityDataSourceDataSelection.cs
- DataBoundControlAdapter.cs
- oledbmetadatacolumnnames.cs
- UnknownWrapper.cs
- HttpUnhandledOperationInvoker.cs
- ValidationHelper.cs
- CodeGeneratorOptions.cs
- HttpDebugHandler.cs
- AssemblyBuilder.cs
- OrderByBuilder.cs
- SerTrace.cs
- Matrix3D.cs
- QueryOperator.cs
- XmlSchemaAnnotated.cs
- newitemfactory.cs
- ValidationErrorCollection.cs
- SQLString.cs
- WpfMemberInvoker.cs
- SizeAnimationUsingKeyFrames.cs
- DialogResultConverter.cs
- WebServiceData.cs
- TextEndOfLine.cs
- ArrangedElement.cs
- Bitmap.cs
- WorkflowServiceBehavior.cs
- XmlAnyElementAttributes.cs
- StateItem.cs
- BaseParagraph.cs
- SuppressMessageAttribute.cs
- DiscoveryRequestHandler.cs
- HwndKeyboardInputProvider.cs
- ErrorHandler.cs
- RadialGradientBrush.cs
- BitmapFrame.cs
- Stream.cs
- PlainXmlDeserializer.cs
- MemoryRecordBuffer.cs
- StylusPointCollection.cs
- DbProviderFactory.cs
- QueueTransferProtocol.cs
- CqlQuery.cs
- ConsoleCancelEventArgs.cs
- HWStack.cs
- Cursors.cs
- WebPartTransformer.cs
- RowBinding.cs
- LinkLabel.cs
- Vector3DCollectionConverter.cs
- SoapExtensionStream.cs
- IDReferencePropertyAttribute.cs
- Bitmap.cs
- HMAC.cs
- SafeNativeMethods.cs
- SpellerError.cs
- ServiceDescriptionReflector.cs
- RightsManagementPermission.cs
- ProfileSection.cs
- BindingCollectionElement.cs
- GridViewColumnCollection.cs
- ByteAnimation.cs
- _LoggingObject.cs
- MethodBuilderInstantiation.cs
- ProcessRequestArgs.cs
- SafeWaitHandle.cs
- ImageSource.cs
- Pkcs7Recipient.cs
- HiddenFieldPageStatePersister.cs
- ByteStreamGeometryContext.cs
- DeclaredTypeValidator.cs
- UserPersonalizationStateInfo.cs
- FunctionParameter.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- CounterCreationDataConverter.cs
- HttpRuntimeSection.cs
- Funcletizer.cs