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
- FormViewInsertedEventArgs.cs
- BridgeDataRecord.cs
- XmlBoundElement.cs
- SmiConnection.cs
- OracleTransaction.cs
- VisualStyleInformation.cs
- SafePointer.cs
- XmlAnyAttributeAttribute.cs
- DockPanel.cs
- ViewStateException.cs
- DataKeyArray.cs
- WindowShowOrOpenTracker.cs
- SequentialUshortCollection.cs
- Int16Converter.cs
- ELinqQueryState.cs
- RestClientProxyHandler.cs
- TypeUtil.cs
- TagPrefixInfo.cs
- XsltInput.cs
- AutoGeneratedFieldProperties.cs
- AsyncOperationLifetimeManager.cs
- SettingsPropertyValue.cs
- RemoteWebConfigurationHost.cs
- EntityDataSourceView.cs
- XmlWrappingReader.cs
- LabelAutomationPeer.cs
- DBProviderConfigurationHandler.cs
- FacetDescriptionElement.cs
- DebugController.cs
- Compiler.cs
- RegexCode.cs
- SoapUnknownHeader.cs
- FacetDescription.cs
- ImageInfo.cs
- HTTPNotFoundHandler.cs
- SoapCodeExporter.cs
- TemplateControlBuildProvider.cs
- _HelperAsyncResults.cs
- FrameworkEventSource.cs
- BindUriHelper.cs
- DynamicResourceExtensionConverter.cs
- Misc.cs
- ProcessRequestArgs.cs
- MSAAEventDispatcher.cs
- BitmapEffectDrawingContextState.cs
- ValueConversionAttribute.cs
- Vector.cs
- CryptoKeySecurity.cs
- OneWayChannelFactory.cs
- ITextView.cs
- GeneralTransform3DGroup.cs
- _AutoWebProxyScriptWrapper.cs
- EmptyEnumerable.cs
- DateTimeParse.cs
- SQLResource.cs
- wmiprovider.cs
- ValidatedControlConverter.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- AttributeSetAction.cs
- MsmqIntegrationProcessProtocolHandler.cs
- PassportAuthenticationModule.cs
- CompilerGlobalScopeAttribute.cs
- ControlTemplate.cs
- AddInDeploymentState.cs
- SignedInfo.cs
- _KerberosClient.cs
- MobileRedirect.cs
- SignedXmlDebugLog.cs
- RuntimeWrappedException.cs
- CleanUpVirtualizedItemEventArgs.cs
- XXXInfos.cs
- DelegateInArgument.cs
- TemplateXamlParser.cs
- XmlWhitespace.cs
- StructureChangedEventArgs.cs
- grammarelement.cs
- VisualStyleElement.cs
- StringAnimationUsingKeyFrames.cs
- coordinator.cs
- IPEndPoint.cs
- SystemIPAddressInformation.cs
- ToolboxComponentsCreatedEventArgs.cs
- XmlUtil.cs
- AutomationElementCollection.cs
- _ShellExpression.cs
- ConfigurationSection.cs
- TypeListConverter.cs
- BitmapEffect.cs
- querybuilder.cs
- _RequestCacheProtocol.cs
- ColorConvertedBitmap.cs
- MenuItemBindingCollection.cs
- XPathAxisIterator.cs
- DateTimeOffsetAdapter.cs
- XmlWrappingWriter.cs
- MouseButtonEventArgs.cs
- SqlClientMetaDataCollectionNames.cs
- categoryentry.cs
- dsa.cs
- CalendarTable.cs