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
- WebPartPersonalization.cs
- AnnouncementSendsAsyncResult.cs
- TreeViewHitTestInfo.cs
- CellRelation.cs
- xsdvalidator.cs
- OdbcCommand.cs
- PageHandlerFactory.cs
- JapaneseLunisolarCalendar.cs
- DictionaryContent.cs
- LayoutEvent.cs
- ReservationNotFoundException.cs
- CheckBoxFlatAdapter.cs
- SvcFileManager.cs
- HandoffBehavior.cs
- IndicShape.cs
- WizardPanel.cs
- XmlUtilWriter.cs
- XmlSchemaObjectTable.cs
- LocalValueEnumerator.cs
- BuildProvider.cs
- EntityDataSourceDataSelectionPanel.cs
- RoleGroup.cs
- InputBinding.cs
- PointAnimation.cs
- MemoryRecordBuffer.cs
- EditorPartDesigner.cs
- IsolatedStorageFile.cs
- Camera.cs
- WorkflowInstanceSuspendedRecord.cs
- OdbcConnectionOpen.cs
- AccessDataSourceView.cs
- Sentence.cs
- GrammarBuilder.cs
- NetCodeGroup.cs
- ActiveXSite.cs
- FrameSecurityDescriptor.cs
- counter.cs
- ModelItemKeyValuePair.cs
- FileSystemInfo.cs
- HttpResponseInternalWrapper.cs
- WindowsMenu.cs
- HTTPNotFoundHandler.cs
- ToolConsole.cs
- TemplateDefinition.cs
- BulletedListDesigner.cs
- NeutralResourcesLanguageAttribute.cs
- DataSetSchema.cs
- AggregateNode.cs
- ParameterBuilder.cs
- DoubleAverageAggregationOperator.cs
- WmlLabelAdapter.cs
- TextWriterTraceListener.cs
- Volatile.cs
- LoginUtil.cs
- translator.cs
- _DisconnectOverlappedAsyncResult.cs
- WindowsEditBox.cs
- OdbcDataAdapter.cs
- DefaultValueMapping.cs
- SchemaDeclBase.cs
- ExtensionElementCollection.cs
- RadioButtonRenderer.cs
- DirectionalLight.cs
- CodeTypeReference.cs
- XPathNodePointer.cs
- AliasGenerator.cs
- PrimitiveDataContract.cs
- Typography.cs
- CssTextWriter.cs
- MdiWindowListItemConverter.cs
- DrawingContextDrawingContextWalker.cs
- CheckBoxAutomationPeer.cs
- ListControlDesigner.cs
- DeploymentSectionCache.cs
- DataGridViewControlCollection.cs
- SimpleLine.cs
- ContentType.cs
- DataBoundControlAdapter.cs
- EUCJPEncoding.cs
- CngKeyBlobFormat.cs
- ObjectSpanRewriter.cs
- SetIterators.cs
- DocumentViewerAutomationPeer.cs
- ToolStripPanelRow.cs
- _UncName.cs
- Number.cs
- RawStylusSystemGestureInputReport.cs
- TableLayout.cs
- NativeRecognizer.cs
- UnauthorizedWebPart.cs
- ISFTagAndGuidCache.cs
- SqlHelper.cs
- MarkupCompilePass1.cs
- AddIn.cs
- DataGridCell.cs
- Listen.cs
- ToolStripHighContrastRenderer.cs
- DependencySource.cs
- SymmetricKey.cs
- TypeInfo.cs