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
- EmbeddedMailObject.cs
- OutputWindow.cs
- XmlCountingReader.cs
- SystemIPInterfaceProperties.cs
- TextTreeInsertUndoUnit.cs
- MasterPageBuildProvider.cs
- BaseCollection.cs
- Bits.cs
- RegexGroupCollection.cs
- DataSourceXmlTextReader.cs
- TemplatePropertyEntry.cs
- ThrowOnMultipleAssignment.cs
- CheckBoxPopupAdapter.cs
- TypeHelper.cs
- DecimalStorage.cs
- ClientSideQueueItem.cs
- Int32AnimationBase.cs
- ComponentConverter.cs
- QueryResults.cs
- ActivationServices.cs
- Rect3DValueSerializer.cs
- Hash.cs
- DataTablePropertyDescriptor.cs
- HttpCookieCollection.cs
- PowerModeChangedEventArgs.cs
- CompilationLock.cs
- ContentFilePart.cs
- StackOverflowException.cs
- SqlNode.cs
- WebPartUserCapability.cs
- Util.cs
- _IPv4Address.cs
- XmlSchemaSimpleContentExtension.cs
- GenericTypeParameterConverter.cs
- GridViewItemAutomationPeer.cs
- Image.cs
- Debug.cs
- SiteMapSection.cs
- XPathPatternParser.cs
- IgnoreFileBuildProvider.cs
- PageParserFilter.cs
- FileUpload.cs
- TreeViewDataItemAutomationPeer.cs
- ExpressionBuilderCollection.cs
- CatalogPart.cs
- Fonts.cs
- ReturnType.cs
- StandardOleMarshalObject.cs
- HandledEventArgs.cs
- ChangePassword.cs
- HttpWebRequestElement.cs
- DnsElement.cs
- InProcStateClientManager.cs
- ListViewAutomationPeer.cs
- RegexStringValidatorAttribute.cs
- VideoDrawing.cs
- SqlReferenceCollection.cs
- LogLogRecordHeader.cs
- Slider.cs
- DefaultHttpHandler.cs
- ListViewPagedDataSource.cs
- MessageDecoder.cs
- CompositeControl.cs
- OdbcErrorCollection.cs
- MergeLocalizationDirectives.cs
- MruCache.cs
- JournalEntryListConverter.cs
- OleDbMetaDataFactory.cs
- RangeBaseAutomationPeer.cs
- ACE.cs
- _LoggingObject.cs
- StringFunctions.cs
- ConfigurationSectionGroup.cs
- MemberRelationshipService.cs
- TextEffect.cs
- CqlQuery.cs
- Converter.cs
- KeyTime.cs
- ThreadPoolTaskScheduler.cs
- BamlWriter.cs
- MaterialGroup.cs
- DbConnectionPoolGroupProviderInfo.cs
- HttpApplicationFactory.cs
- DocumentViewerBase.cs
- DependencyObjectValidator.cs
- SessionPageStatePersister.cs
- Size.cs
- NullableIntSumAggregationOperator.cs
- BCryptHashAlgorithm.cs
- SimpleBitVector32.cs
- PagesSection.cs
- HintTextMaxWidthConverter.cs
- IPAddress.cs
- ResourcePermissionBaseEntry.cs
- AppSecurityManager.cs
- XmlQueryType.cs
- Application.cs
- EpmCustomContentSerializer.cs
- ping.cs
- SqlTriggerAttribute.cs