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
- HttpModulesSection.cs
- SignatureHelper.cs
- MarkupCompilePass1.cs
- ColumnMapTranslator.cs
- mactripleDES.cs
- SevenBitStream.cs
- RowUpdatedEventArgs.cs
- UmAlQuraCalendar.cs
- ErasingStroke.cs
- VectorCollection.cs
- Hash.cs
- XmlILCommand.cs
- CompiledXpathExpr.cs
- EventlogProvider.cs
- TableLayoutPanelCellPosition.cs
- AsyncOperation.cs
- TypeUtil.cs
- TreeNodeCollection.cs
- ErrorWrapper.cs
- KeyConverter.cs
- CustomAttributeBuilder.cs
- Assert.cs
- ThrowOnMultipleAssignment.cs
- AppDomainProtocolHandler.cs
- ProtocolViolationException.cs
- HealthMonitoringSectionHelper.cs
- PolyQuadraticBezierSegment.cs
- DbConnectionFactory.cs
- Formatter.cs
- NamedPipeAppDomainProtocolHandler.cs
- HttpDebugHandler.cs
- CssTextWriter.cs
- WindowsFormsDesignerOptionService.cs
- ConstrainedDataObject.cs
- AdornerDecorator.cs
- SettingsPropertyValueCollection.cs
- XamlFigureLengthSerializer.cs
- InputLanguageSource.cs
- InkCanvas.cs
- CodeExpressionStatement.cs
- RemoveStoryboard.cs
- WebPartDisplayModeCollection.cs
- DotExpr.cs
- AssemblyNameProxy.cs
- TextLine.cs
- DataGridViewLayoutData.cs
- CriticalExceptions.cs
- precedingquery.cs
- HttpValueCollection.cs
- basenumberconverter.cs
- DurableRuntimeValidator.cs
- BooleanFacetDescriptionElement.cs
- Attribute.cs
- ToolboxItemCollection.cs
- ObjectTag.cs
- ListMarkerSourceInfo.cs
- mediaclock.cs
- SoapIgnoreAttribute.cs
- XmlSerializerNamespaces.cs
- HandledEventArgs.cs
- UnmanagedMemoryAccessor.cs
- WebControl.cs
- BitmapImage.cs
- AnnotationResource.cs
- AssertUtility.cs
- EventWaitHandle.cs
- CachedTypeface.cs
- FileDialog.cs
- DbConnectionClosed.cs
- StorageScalarPropertyMapping.cs
- GetWinFXPath.cs
- AutomationProperties.cs
- UInt32Storage.cs
- XamlStream.cs
- DataFormats.cs
- ArrayWithOffset.cs
- CheckBox.cs
- GeneralTransform.cs
- XmlIlTypeHelper.cs
- PersonalizableAttribute.cs
- DataGridViewCellEventArgs.cs
- Certificate.cs
- COM2TypeInfoProcessor.cs
- SmtpException.cs
- MessageOperationFormatter.cs
- _TransmitFileOverlappedAsyncResult.cs
- PKCS1MaskGenerationMethod.cs
- CubicEase.cs
- DataBoundControlDesigner.cs
- DataColumnMapping.cs
- DataGridViewDataErrorEventArgs.cs
- XamlToRtfParser.cs
- DiscoveryEndpoint.cs
- NewItemsContextMenuStrip.cs
- ControlCachePolicy.cs
- XmlHierarchyData.cs
- MenuItemBinding.cs
- ReceiveActivityDesignerTheme.cs
- LinqDataSourceEditData.cs
- ActivityExecutorSurrogate.cs