Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / XmlSerializableServices.cs / 1 / XmlSerializableServices.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Reflection; using System.Text; using System.Xml; using System.Xml.Serialization; using System.Xml.Schema; using System.Xml.XPath; using System.Security; namespace System.Runtime.Serialization { public static class XmlSerializableServices { ////// Review - Static fields are marked SecurityCritical or readonly to prevent /// data from being modified or leaked to other components in appdomain. /// [SecurityRequiresReview] internal static readonly string ReadNodesMethodName = "ReadNodes"; public static XmlNode[] ReadNodes(XmlReader xmlReader) { if (xmlReader == null) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("xmlReader"); XmlDocument doc = new XmlDocument(); ListnodeList = new List (); if (xmlReader.MoveToFirstAttribute()) { do { if (IsValidAttribute(xmlReader)) { XmlNode node = doc.ReadNode(xmlReader); if (node == null) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.UnexpectedEndOfFile))); nodeList.Add(node); } } while (xmlReader.MoveToNextAttribute()); } xmlReader.MoveToElement(); if (!xmlReader.IsEmptyElement) { int startDepth = xmlReader.Depth; xmlReader.Read(); while (xmlReader.Depth > startDepth && xmlReader.NodeType != XmlNodeType.EndElement) { XmlNode node = doc.ReadNode(xmlReader); if (node == null) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.UnexpectedEndOfFile))); nodeList.Add(node); } } return nodeList.ToArray(); } private static bool IsValidAttribute(XmlReader xmlReader) { return xmlReader.NamespaceURI != Globals.SerializationNamespace && xmlReader.NamespaceURI != Globals.SchemaInstanceNamespace && xmlReader.Prefix != "xmlns" && xmlReader.LocalName != "xmlns"; } internal static string WriteNodesMethodName = "WriteNodes"; public static void WriteNodes(XmlWriter xmlWriter, XmlNode[] nodes) { if (xmlWriter == null) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("xmlWriter"); if (nodes != null) for(int i=0;i
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UInt32.cs
- FixedDocumentPaginator.cs
- NavigationWindow.cs
- SplitterEvent.cs
- SoapSchemaMember.cs
- RegistryExceptionHelper.cs
- ValidatorCollection.cs
- Int16Storage.cs
- RegexCode.cs
- WebBrowserDocumentCompletedEventHandler.cs
- SupportingTokenBindingElement.cs
- DelegateTypeInfo.cs
- TextBlockAutomationPeer.cs
- SoundPlayer.cs
- SemaphoreSlim.cs
- FileClassifier.cs
- ApplicationBuildProvider.cs
- ModelItemImpl.cs
- XmlEncodedRawTextWriter.cs
- RemotingAttributes.cs
- StickyNoteHelper.cs
- ArithmeticLiteral.cs
- XsltCompileContext.cs
- CustomErrorsSectionWrapper.cs
- AssemblyName.cs
- AsyncPostBackErrorEventArgs.cs
- ZipArchive.cs
- NativeWindow.cs
- DbMetaDataColumnNames.cs
- PriorityChain.cs
- ApplicationDirectoryMembershipCondition.cs
- NameObjectCollectionBase.cs
- XmlLinkedNode.cs
- DataGridViewHeaderCell.cs
- Content.cs
- DataGridLengthConverter.cs
- RequestCacheEntry.cs
- ConfigsHelper.cs
- ProfileServiceManager.cs
- ResponseBodyWriter.cs
- XmlSiteMapProvider.cs
- XPathArrayIterator.cs
- TypeDefinition.cs
- DescendantBaseQuery.cs
- ChildrenQuery.cs
- returneventsaver.cs
- PartEditor.cs
- InternalDispatchObject.cs
- securitycriticaldataformultiplegetandset.cs
- VBIdentifierName.cs
- cookie.cs
- PlaceHolder.cs
- MarkerProperties.cs
- DataGridItem.cs
- ProjectionPruner.cs
- TypeConverterHelper.cs
- SelectionItemPattern.cs
- HelpProvider.cs
- CodeCommentStatement.cs
- DependsOnAttribute.cs
- AmbiguousMatchException.cs
- SqlBuffer.cs
- TextRunProperties.cs
- PathData.cs
- FormsAuthenticationModule.cs
- DesignSurfaceManager.cs
- BindableTemplateBuilder.cs
- DataListItemEventArgs.cs
- UnknownBitmapDecoder.cs
- FacetDescriptionElement.cs
- Terminate.cs
- Interlocked.cs
- Package.cs
- WorkflowInstanceUnhandledExceptionRecord.cs
- _HelperAsyncResults.cs
- DefaultTextStoreTextComposition.cs
- DbConnectionClosed.cs
- BrushConverter.cs
- EntityDataSourceChangingEventArgs.cs
- StaticContext.cs
- ListViewDeleteEventArgs.cs
- WebPartDeleteVerb.cs
- WaitingCursor.cs
- ConnectorDragDropGlyph.cs
- EnumMemberAttribute.cs
- PersonalizationState.cs
- FormViewPagerRow.cs
- XsltLoader.cs
- APCustomTypeDescriptor.cs
- HelpFileFileNameEditor.cs
- XmlSchemaSet.cs
- BuildManagerHost.cs
- TextBoxView.cs
- ClientBuildManagerCallback.cs
- NativeMethods.cs
- TransformPattern.cs
- NamespaceDecl.cs
- NonBatchDirectoryCompiler.cs
- AddInController.cs
- VirtualPath.cs