Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / XmlUtils / System / Xml / Xsl / QueryReaderSettings.cs / 1 / QueryReaderSettings.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Xml; namespace System.Xml.Xsl { internal class QueryReaderSettings { private bool validatingReader; private XmlReaderSettings xmlReaderSettings; private XmlNameTable xmlNameTable; private EntityHandling entityHandling; private bool namespaces; private bool normalization; private bool prohibitDtd; private WhitespaceHandling whitespaceHandling; private XmlResolver xmlResolver; public QueryReaderSettings(XmlNameTable xmlNameTable) { Debug.Assert(xmlNameTable != null); xmlReaderSettings = new XmlReaderSettings(); xmlReaderSettings.NameTable = xmlNameTable; xmlReaderSettings.ConformanceLevel = ConformanceLevel.Document; xmlReaderSettings.XmlResolver = null; xmlReaderSettings.ProhibitDtd = true; xmlReaderSettings.CloseInput = true; } public QueryReaderSettings(XmlReader reader) { #pragma warning disable 618 XmlValidatingReader valReader = reader as XmlValidatingReader; #pragma warning restore 618 if (valReader != null) { // Unwrap validation reader validatingReader = true; reader = valReader.Impl.Reader; } xmlReaderSettings = reader.Settings; if (xmlReaderSettings != null) { xmlReaderSettings = xmlReaderSettings.Clone(); xmlReaderSettings.NameTable = reader.NameTable; xmlReaderSettings.CloseInput = true; xmlReaderSettings.LineNumberOffset = 0; xmlReaderSettings.LinePositionOffset = 0; XmlTextReaderImpl impl = reader as XmlTextReaderImpl; if (impl != null) { xmlReaderSettings.XmlResolver = impl.GetResolver(); } } else { xmlNameTable = reader.NameTable; XmlTextReader xmlTextReader = reader as XmlTextReader; if (xmlTextReader != null) { XmlTextReaderImpl impl = xmlTextReader.Impl; entityHandling = impl.EntityHandling; namespaces = impl.Namespaces; normalization = impl.Normalization; prohibitDtd = impl.ProhibitDtd; whitespaceHandling = impl.WhitespaceHandling; xmlResolver = impl.GetResolver(); } else { entityHandling = EntityHandling.ExpandEntities; namespaces = true; normalization = true; prohibitDtd = true; whitespaceHandling = WhitespaceHandling.All; xmlResolver = null; } } } public XmlReader CreateReader(Stream stream, string baseUri) { XmlReader reader; if (xmlReaderSettings != null) { reader = XmlTextReader.Create(stream, xmlReaderSettings, baseUri); } else { XmlTextReaderImpl readerImpl = new XmlTextReaderImpl(baseUri, stream, xmlNameTable); readerImpl.EntityHandling = entityHandling; readerImpl.Namespaces = namespaces; readerImpl.Normalization = normalization; readerImpl.ProhibitDtd = prohibitDtd; readerImpl.WhitespaceHandling = whitespaceHandling; readerImpl.XmlResolver = xmlResolver; reader = readerImpl; } if (validatingReader) { #pragma warning disable 618 reader = new XmlValidatingReader(reader); #pragma warning restore 618 } return reader; } public XmlNameTable NameTable { get { return xmlReaderSettings != null ? xmlReaderSettings.NameTable : xmlNameTable; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Xml; namespace System.Xml.Xsl { internal class QueryReaderSettings { private bool validatingReader; private XmlReaderSettings xmlReaderSettings; private XmlNameTable xmlNameTable; private EntityHandling entityHandling; private bool namespaces; private bool normalization; private bool prohibitDtd; private WhitespaceHandling whitespaceHandling; private XmlResolver xmlResolver; public QueryReaderSettings(XmlNameTable xmlNameTable) { Debug.Assert(xmlNameTable != null); xmlReaderSettings = new XmlReaderSettings(); xmlReaderSettings.NameTable = xmlNameTable; xmlReaderSettings.ConformanceLevel = ConformanceLevel.Document; xmlReaderSettings.XmlResolver = null; xmlReaderSettings.ProhibitDtd = true; xmlReaderSettings.CloseInput = true; } public QueryReaderSettings(XmlReader reader) { #pragma warning disable 618 XmlValidatingReader valReader = reader as XmlValidatingReader; #pragma warning restore 618 if (valReader != null) { // Unwrap validation reader validatingReader = true; reader = valReader.Impl.Reader; } xmlReaderSettings = reader.Settings; if (xmlReaderSettings != null) { xmlReaderSettings = xmlReaderSettings.Clone(); xmlReaderSettings.NameTable = reader.NameTable; xmlReaderSettings.CloseInput = true; xmlReaderSettings.LineNumberOffset = 0; xmlReaderSettings.LinePositionOffset = 0; XmlTextReaderImpl impl = reader as XmlTextReaderImpl; if (impl != null) { xmlReaderSettings.XmlResolver = impl.GetResolver(); } } else { xmlNameTable = reader.NameTable; XmlTextReader xmlTextReader = reader as XmlTextReader; if (xmlTextReader != null) { XmlTextReaderImpl impl = xmlTextReader.Impl; entityHandling = impl.EntityHandling; namespaces = impl.Namespaces; normalization = impl.Normalization; prohibitDtd = impl.ProhibitDtd; whitespaceHandling = impl.WhitespaceHandling; xmlResolver = impl.GetResolver(); } else { entityHandling = EntityHandling.ExpandEntities; namespaces = true; normalization = true; prohibitDtd = true; whitespaceHandling = WhitespaceHandling.All; xmlResolver = null; } } } public XmlReader CreateReader(Stream stream, string baseUri) { XmlReader reader; if (xmlReaderSettings != null) { reader = XmlTextReader.Create(stream, xmlReaderSettings, baseUri); } else { XmlTextReaderImpl readerImpl = new XmlTextReaderImpl(baseUri, stream, xmlNameTable); readerImpl.EntityHandling = entityHandling; readerImpl.Namespaces = namespaces; readerImpl.Normalization = normalization; readerImpl.ProhibitDtd = prohibitDtd; readerImpl.WhitespaceHandling = whitespaceHandling; readerImpl.XmlResolver = xmlResolver; reader = readerImpl; } if (validatingReader) { #pragma warning disable 618 reader = new XmlValidatingReader(reader); #pragma warning restore 618 } return reader; } public XmlNameTable NameTable { get { return xmlReaderSettings != null ? xmlReaderSettings.NameTable : xmlNameTable; } } } } // 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
- oledbmetadatacollectionnames.cs
- ViewDesigner.cs
- SourceItem.cs
- GridViewColumnHeaderAutomationPeer.cs
- SerializationHelper.cs
- LayoutEditorPart.cs
- MessageDecoder.cs
- ApplicationTrust.cs
- SamlAdvice.cs
- FormViewRow.cs
- SqlBuilder.cs
- ByteStack.cs
- RsaSecurityKey.cs
- DuplicateWaitObjectException.cs
- RectAnimationClockResource.cs
- StaticDataManager.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- UnmanagedBitmapWrapper.cs
- RecognizerInfo.cs
- XPathSelectionIterator.cs
- PasswordBoxAutomationPeer.cs
- ListenerUnsafeNativeMethods.cs
- XamlWriter.cs
- Win32MouseDevice.cs
- MethodBuilderInstantiation.cs
- DataServiceResponse.cs
- ConfigurationConverterBase.cs
- TemplateBamlTreeBuilder.cs
- EntityDescriptor.cs
- XpsSerializerFactory.cs
- BindingMemberInfo.cs
- CompoundFileStreamReference.cs
- ColorEditor.cs
- BooleanExpr.cs
- SurrogateSelector.cs
- BStrWrapper.cs
- Model3DGroup.cs
- HttpApplicationFactory.cs
- MissingManifestResourceException.cs
- HttpFileCollectionWrapper.cs
- SafeTimerHandle.cs
- WindowsPrincipal.cs
- HTTPRemotingHandler.cs
- StrongBox.cs
- CheckBoxFlatAdapter.cs
- PopOutPanel.cs
- TextEndOfSegment.cs
- Group.cs
- securitymgrsite.cs
- FileClassifier.cs
- DefaultTraceListener.cs
- LazyTextWriterCreator.cs
- _SpnDictionary.cs
- DataErrorValidationRule.cs
- EventBuilder.cs
- SafeEventLogWriteHandle.cs
- _SingleItemRequestCache.cs
- StaticSiteMapProvider.cs
- XmlDocumentFieldSchema.cs
- CustomErrorCollection.cs
- Rfc4050KeyFormatter.cs
- OAVariantLib.cs
- ImageList.cs
- SchemaElementLookUpTable.cs
- SupportingTokenDuplexChannel.cs
- Authorization.cs
- Root.cs
- DetailsViewDeleteEventArgs.cs
- HierarchicalDataSourceConverter.cs
- ValueProviderWrapper.cs
- GetPageCompletedEventArgs.cs
- Point3DAnimationBase.cs
- OleDbRowUpdatedEvent.cs
- ArrangedElement.cs
- TreeView.cs
- EntityViewContainer.cs
- NamedPermissionSet.cs
- TrackPoint.cs
- CompiledXpathExpr.cs
- CloudCollection.cs
- TrackBar.cs
- MemberCollection.cs
- MenuBase.cs
- HttpInputStream.cs
- ScrollEventArgs.cs
- WindowsFormsLinkLabel.cs
- ExtendedProperty.cs
- ParameterElementCollection.cs
- SqlCacheDependencyDatabaseCollection.cs
- RegexBoyerMoore.cs
- CommandManager.cs
- PassportAuthenticationModule.cs
- TextDecorations.cs
- WindowsHyperlink.cs
- ValueTypeFixupInfo.cs
- XmlIgnoreAttribute.cs
- XmlExpressionDumper.cs
- FileAuthorizationModule.cs
- RegistryConfigurationProvider.cs
- TextServicesPropertyRanges.cs