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
- DocumentApplicationJournalEntry.cs
- ImageInfo.cs
- ListSortDescription.cs
- SqlProcedureAttribute.cs
- DiagnosticsConfigurationHandler.cs
- RC2.cs
- BorderGapMaskConverter.cs
- AsyncPostBackTrigger.cs
- HtmlImage.cs
- TextRunProperties.cs
- ComponentConverter.cs
- XmlSerializationReader.cs
- ConnectionInterfaceCollection.cs
- SQLBytes.cs
- Themes.cs
- StylusPointProperties.cs
- ListItemViewAttribute.cs
- Image.cs
- XmlSchemaComplexType.cs
- HttpCapabilitiesEvaluator.cs
- KeyEvent.cs
- InteropTrackingRecord.cs
- ArrayList.cs
- BamlLocalizationDictionary.cs
- XmlEnumAttribute.cs
- WebEncodingValidator.cs
- ContextMarshalException.cs
- DocumentSequence.cs
- ApplicationInfo.cs
- SHA384Managed.cs
- PointValueSerializer.cs
- _Connection.cs
- LeftCellWrapper.cs
- ScriptReferenceBase.cs
- TextBox.cs
- RtfControlWordInfo.cs
- BufferBuilder.cs
- httpstaticobjectscollection.cs
- CultureSpecificCharacterBufferRange.cs
- DoubleUtil.cs
- BufferedGraphicsManager.cs
- EntityDataSourceWrapperCollection.cs
- CodeTypeParameter.cs
- sitestring.cs
- DataContractAttribute.cs
- WindowsContainer.cs
- PagerSettings.cs
- TransformerInfo.cs
- CollaborationHelperFunctions.cs
- DataSourceListEditor.cs
- Condition.cs
- SrgsGrammarCompiler.cs
- ProviderSettingsCollection.cs
- ContextActivityUtils.cs
- LineSegment.cs
- CharEntityEncoderFallback.cs
- SequentialOutput.cs
- DelegatingHeader.cs
- IndentedWriter.cs
- GlobalItem.cs
- Quaternion.cs
- WebReferenceOptions.cs
- SystemWebCachingSectionGroup.cs
- HebrewCalendar.cs
- XmlAnyElementAttribute.cs
- AppliedDeviceFiltersEditor.cs
- DPAPIProtectedConfigurationProvider.cs
- MetaChildrenColumn.cs
- SerializableTypeCodeDomSerializer.cs
- PropertyRecord.cs
- HttpStreams.cs
- FileNotFoundException.cs
- PageSettings.cs
- Math.cs
- ManagementObjectSearcher.cs
- FacetChecker.cs
- XPathAxisIterator.cs
- BindableTemplateBuilder.cs
- UserControl.cs
- SqlNotificationEventArgs.cs
- BamlTreeUpdater.cs
- DbProviderFactories.cs
- ParagraphVisual.cs
- ParameterElementCollection.cs
- ScrollChrome.cs
- BitmapMetadataEnumerator.cs
- SystemInfo.cs
- UIInitializationException.cs
- InternalSafeNativeMethods.cs
- DataGridViewColumnEventArgs.cs
- ContextMarshalException.cs
- TextReader.cs
- SmtpClient.cs
- DateTimeStorage.cs
- SrgsRuleRef.cs
- SolidBrush.cs
- LayoutManager.cs
- CalloutQueueItem.cs
- TileModeValidation.cs
- RecognizerInfo.cs