Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / XmlHelper.cs / 1 / 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. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DocumentSequence.cs
- returneventsaver.cs
- HMACRIPEMD160.cs
- HttpStaticObjectsCollectionWrapper.cs
- TransformerInfo.cs
- ClientData.cs
- ConfigurationStrings.cs
- GridViewRowPresenterBase.cs
- NetWebProxyFinder.cs
- RelationshipSet.cs
- AppDomainAttributes.cs
- TextBoxView.cs
- XPathNavigatorException.cs
- HtmlTableCell.cs
- DataGridViewUtilities.cs
- RegexRunnerFactory.cs
- AspNetSynchronizationContext.cs
- FileUpload.cs
- PropertySourceInfo.cs
- OdbcStatementHandle.cs
- WebPartManager.cs
- BrowsableAttribute.cs
- ToolboxCategoryItems.cs
- DataGridViewCellStyleChangedEventArgs.cs
- ParallelRangeManager.cs
- WindowManager.cs
- TableCellAutomationPeer.cs
- MarkupProperty.cs
- SafeSecurityHandles.cs
- DateTimeConverter.cs
- FileAuthorizationModule.cs
- __ComObject.cs
- DataReaderContainer.cs
- StyleCollection.cs
- ListControl.cs
- ServiceElement.cs
- WebPartsPersonalizationAuthorization.cs
- HtmlSelect.cs
- ApplicationCommands.cs
- MetabaseServerConfig.cs
- OutputCacheProviderCollection.cs
- BindingContext.cs
- precedingquery.cs
- PagePropertiesChangingEventArgs.cs
- DecoderReplacementFallback.cs
- MessageSecurityOverTcpElement.cs
- WebDisplayNameAttribute.cs
- CompilationLock.cs
- DataSourceNameHandler.cs
- __ConsoleStream.cs
- ConstantExpression.cs
- PathGeometry.cs
- DeferredSelectedIndexReference.cs
- DrawingDrawingContext.cs
- SBCSCodePageEncoding.cs
- TCEAdapterGenerator.cs
- TrustLevel.cs
- LingerOption.cs
- CompositeFontParser.cs
- NavigationProperty.cs
- FontFaceLayoutInfo.cs
- SqlDataRecord.cs
- UnsafeNativeMethods.cs
- querybuilder.cs
- JoinElimination.cs
- EventLogReader.cs
- MembershipUser.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- TextContainerHelper.cs
- NullableConverter.cs
- DataBoundLiteralControl.cs
- TextLineResult.cs
- PaginationProgressEventArgs.cs
- MemberPath.cs
- SubclassTypeValidatorAttribute.cs
- ReadContentAsBinaryHelper.cs
- RemoteDebugger.cs
- SignatureToken.cs
- ContractSearchPattern.cs
- EventSinkActivity.cs
- PathSegmentCollection.cs
- AddressUtility.cs
- ColumnCollection.cs
- Pointer.cs
- FormViewPageEventArgs.cs
- ScrollPatternIdentifiers.cs
- linebase.cs
- DashStyle.cs
- PropertyExpression.cs
- DbConvert.cs
- CodeAttributeArgument.cs
- StreamReader.cs
- Semaphore.cs
- VisualTreeHelper.cs
- SmtpFailedRecipientsException.cs
- DynamicResourceExtensionConverter.cs
- CacheVirtualItemsEvent.cs
- TargetPerspective.cs
- OptimalTextSource.cs
- UInt64Converter.cs