Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / XmlHelper.cs / 1305376 / XmlHelper.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel { using System.IO; using System.Text; using System.Xml; static class XmlHelper { internal static string GetWhiteSpace(XmlReader reader) { string s = null; StringBuilder sb = null; while (reader.NodeType == XmlNodeType.Whitespace || reader.NodeType == XmlNodeType.SignificantWhitespace) { if (sb != null) { sb.Append(reader.Value); } else if (s != null) { sb = new StringBuilder(s); sb.Append(reader.Value); s = null; } else { s = reader.Value; } if (!reader.Read()) { break; } } return sb != null ? sb.ToString() : s; } internal static void OnRequiredAttributeMissing(string attrName, string elementName) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.RequiredAttributeMissing, attrName, elementName))); } internal static string ReadEmptyElementAndRequiredAttribute(XmlDictionaryReader reader, XmlDictionaryString name, XmlDictionaryString namespaceUri, XmlDictionaryString attributeName, out string prefix) { reader.MoveToStartElement(name, namespaceUri); prefix = reader.Prefix; bool isEmptyElement = reader.IsEmptyElement; string value = reader.GetAttribute(attributeName, null); if (value == null) { OnRequiredAttributeMissing(attributeName.Value, null); } reader.Read(); if (!isEmptyElement) { reader.ReadEndElement(); } return value; } internal static string ReadTextElementAsTrimmedString(XmlElement element) { if (element == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element"); } XmlReader reader = new XmlNodeReader(element); reader.MoveToContent(); return XmlUtil.Trim(reader.ReadElementContentAsString()); } } } // 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
- XamlDebuggerXmlReader.cs
- CheckBoxBaseAdapter.cs
- _ContextAwareResult.cs
- InputLanguageCollection.cs
- ListViewSelectEventArgs.cs
- MinMaxParagraphWidth.cs
- HostExecutionContextManager.cs
- TextTrailingCharacterEllipsis.cs
- ITextView.cs
- TabControlDesigner.cs
- IDReferencePropertyAttribute.cs
- __Filters.cs
- MessageFilter.cs
- _NegotiateClient.cs
- Bold.cs
- AttributeProviderAttribute.cs
- RelationHandler.cs
- BufferBuilder.cs
- NumericPagerField.cs
- MdiWindowListItemConverter.cs
- DocumentViewerAutomationPeer.cs
- HtmlContainerControl.cs
- FactoryGenerator.cs
- SmiEventSink_DeferedProcessing.cs
- VarInfo.cs
- UIElement3DAutomationPeer.cs
- LinqDataSourceValidationException.cs
- BitmapCodecInfo.cs
- IfAction.cs
- ProgressiveCrcCalculatingStream.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- Subordinate.cs
- xmlglyphRunInfo.cs
- XmlSchemaAny.cs
- PerformanceCounterPermission.cs
- listitem.cs
- Misc.cs
- UncommonField.cs
- ObjectNotFoundException.cs
- XmlResolver.cs
- IgnoreFileBuildProvider.cs
- objectquery_tresulttype.cs
- Cursors.cs
- SystemTcpConnection.cs
- CompilerGlobalScopeAttribute.cs
- BasePattern.cs
- MiniCustomAttributeInfo.cs
- FrameSecurityDescriptor.cs
- SqlUdtInfo.cs
- NullRuntimeConfig.cs
- MethodRental.cs
- HttpCacheVary.cs
- XmlAttribute.cs
- DataServiceEntityAttribute.cs
- ProtectedProviderSettings.cs
- Console.cs
- RealizationContext.cs
- Internal.cs
- SecurityAppliedMessage.cs
- ButtonFieldBase.cs
- RetrieveVirtualItemEventArgs.cs
- SafeEventLogWriteHandle.cs
- SortDescriptionCollection.cs
- X509CertificateInitiatorServiceCredential.cs
- InternalConfigRoot.cs
- OleDbParameterCollection.cs
- SystemInfo.cs
- DbConnectionPoolCounters.cs
- GridPattern.cs
- ColorBlend.cs
- RuntimeCompatibilityAttribute.cs
- XPathNavigator.cs
- ButtonField.cs
- RegexCode.cs
- PerspectiveCamera.cs
- XmlExpressionDumper.cs
- NameSpaceExtractor.cs
- VectorAnimationBase.cs
- altserialization.cs
- DictionaryContent.cs
- FormsAuthenticationTicket.cs
- BinaryObjectReader.cs
- LocationReferenceValue.cs
- SmiContext.cs
- SafeNativeMethods.cs
- ResourceType.cs
- ByteKeyFrameCollection.cs
- Int16Storage.cs
- Visual3D.cs
- PointLight.cs
- BamlBinaryReader.cs
- TextBreakpoint.cs
- ReadContentAsBinaryHelper.cs
- InertiaRotationBehavior.cs
- ModuleBuilderData.cs
- ManifestResourceInfo.cs
- graph.cs
- ScalarConstant.cs
- NotConverter.cs
- TextServicesManager.cs