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
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- PlanCompiler.cs
- CellCreator.cs
- SoapInteropTypes.cs
- HttpServerProtocol.cs
- DataGridViewCellStyleBuilderDialog.cs
- SerializerProvider.cs
- Pair.cs
- PackagePartCollection.cs
- QueryCoreOp.cs
- DbConnectionPoolGroupProviderInfo.cs
- ClientSettingsStore.cs
- SelectionItemProviderWrapper.cs
- NodeInfo.cs
- MissingManifestResourceException.cs
- PermissionSet.cs
- PreservationFileWriter.cs
- PageCache.cs
- PageClientProxyGenerator.cs
- UITypeEditor.cs
- List.cs
- CodeArgumentReferenceExpression.cs
- AbstractDataSvcMapFileLoader.cs
- UntrustedRecipientException.cs
- Operand.cs
- ModuleBuilderData.cs
- GeometryHitTestResult.cs
- QueryInterceptorAttribute.cs
- NameSpaceEvent.cs
- VirtualizingPanel.cs
- FlowNode.cs
- Typography.cs
- QualificationDataItem.cs
- ComponentSerializationService.cs
- Pkcs7Recipient.cs
- StandardCommands.cs
- EdgeProfileValidation.cs
- BooleanFunctions.cs
- FramingChannels.cs
- NCryptSafeHandles.cs
- SecureUICommand.cs
- ThrowHelper.cs
- GridViewColumnHeader.cs
- BasicKeyConstraint.cs
- XmlSchemaExternal.cs
- SqlDelegatedTransaction.cs
- EmptyElement.cs
- CLSCompliantAttribute.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- SecurityException.cs
- CodeArgumentReferenceExpression.cs
- DetailsViewDeletedEventArgs.cs
- PerformanceCounterPermissionEntryCollection.cs
- MemberDomainMap.cs
- BaseCodeDomTreeGenerator.cs
- Span.cs
- BitVec.cs
- PenContext.cs
- ImageInfo.cs
- Formatter.cs
- OwnerDrawPropertyBag.cs
- FontInfo.cs
- WebControlToolBoxItem.cs
- TimeSpanOrInfiniteValidator.cs
- WebEventCodes.cs
- GuidelineCollection.cs
- Typeface.cs
- ParameterCollection.cs
- ButtonField.cs
- HttpCacheParams.cs
- XmlSchemaType.cs
- CommonBehaviorsSection.cs
- StylusPointDescription.cs
- Rfc2898DeriveBytes.cs
- TextBoxAutomationPeer.cs
- ToolStripItemCollection.cs
- EdmEntityTypeAttribute.cs
- IBuiltInEvidence.cs
- MatrixStack.cs
- SafeLocalAllocation.cs
- Window.cs
- _SSPISessionCache.cs
- UnmanagedMemoryAccessor.cs
- AssertSection.cs
- DataServiceQuery.cs
- DictionaryTraceRecord.cs
- DecimalConverter.cs
- BackStopAuthenticationModule.cs
- ListViewEditEventArgs.cs
- PrintPreviewControl.cs
- Ref.cs
- MdiWindowListStrip.cs
- WindowsRichEditRange.cs
- ConfigurationValues.cs
- elementinformation.cs
- HtmlInputRadioButton.cs
- ResourceContainer.cs
- DetailsViewDeletedEventArgs.cs
- Parser.cs
- XmlDataDocument.cs