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
- XmlBinaryWriterSession.cs
- ConfigXmlCDataSection.cs
- ThemeInfoAttribute.cs
- ConnectionConsumerAttribute.cs
- ObjectDataSourceSelectingEventArgs.cs
- BasicExpandProvider.cs
- WmiEventSink.cs
- DrawingAttributeSerializer.cs
- DesignerDataStoredProcedure.cs
- AnimationClock.cs
- HttpListenerContext.cs
- TreeViewHitTestInfo.cs
- TypeConverterHelper.cs
- MenuItemBinding.cs
- Calendar.cs
- XmlLoader.cs
- TypeReference.cs
- PersistenceException.cs
- MonthCalendar.cs
- DataGridPageChangedEventArgs.cs
- DataSourceHelper.cs
- SqlCommandAsyncResult.cs
- AjaxFrameworkAssemblyAttribute.cs
- WebBrowserBase.cs
- ContextMenu.cs
- WeakReference.cs
- DataGridViewLayoutData.cs
- RegionData.cs
- AdornerPresentationContext.cs
- GridToolTip.cs
- InlineObject.cs
- sqlstateclientmanager.cs
- OutputCacheSettingsSection.cs
- FixedHyperLink.cs
- RelatedView.cs
- Vector.cs
- PathSegmentCollection.cs
- CommentEmitter.cs
- XPathSelectionIterator.cs
- RouteParametersHelper.cs
- CharKeyFrameCollection.cs
- State.cs
- LabelAutomationPeer.cs
- InertiaExpansionBehavior.cs
- IPAddressCollection.cs
- ImpersonateTokenRef.cs
- CodeRemoveEventStatement.cs
- WinFormsComponentEditor.cs
- ConditionalAttribute.cs
- GenericsInstances.cs
- HttpConfigurationContext.cs
- HttpClientCertificate.cs
- WindowsIPAddress.cs
- MetabaseServerConfig.cs
- DependencyProperty.cs
- RequestContext.cs
- PersianCalendar.cs
- RtfToken.cs
- OleDbErrorCollection.cs
- CodeTypeOfExpression.cs
- JsonEnumDataContract.cs
- RunClient.cs
- XmlC14NWriter.cs
- XmlDocumentFragment.cs
- KeyInterop.cs
- CultureTable.cs
- HierarchicalDataSourceControl.cs
- Screen.cs
- CategoryNameCollection.cs
- UrlPath.cs
- FlatButtonAppearance.cs
- CodeDomLocalizationProvider.cs
- MetafileHeaderEmf.cs
- SingleConverter.cs
- RoleGroup.cs
- UserControlDesigner.cs
- CompatibleComparer.cs
- SmtpSection.cs
- PageEventArgs.cs
- TextElement.cs
- ManifestResourceInfo.cs
- ObjectListCommand.cs
- BasicHttpBinding.cs
- DynamicRouteExpression.cs
- RegistryKey.cs
- Transactions.cs
- MapPathBasedVirtualPathProvider.cs
- OdbcPermission.cs
- ReceiveSecurityHeader.cs
- AsyncCompletedEventArgs.cs
- OracleMonthSpan.cs
- JsonWriterDelegator.cs
- HtmlTitle.cs
- CmsUtils.cs
- ForeignKeyFactory.cs
- DispatcherOperation.cs
- RoleManagerModule.cs
- NotCondition.cs
- GroupItemAutomationPeer.cs
- RelationshipConverter.cs