Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Xml / System / Xml / Core / XmlValidatingReader.cs / 1 / XmlValidatingReader.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
using System;
using System.IO;
using System.Text;
using System.Xml.Schema;
using System.Collections;
using System.Collections.Generic;
using System.Security.Permissions;
namespace System.Xml
{
[PermissionSetAttribute( SecurityAction.InheritanceDemand, Name = "FullTrust" )]
[Obsolete("Use XmlReader created by XmlReader.Create() method using appropriate XmlReaderSettings instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public class XmlValidatingReader : XmlReader, IXmlLineInfo, IXmlNamespaceResolver {
//
// Member fields
//
XmlValidatingReaderImpl impl;
//
// Constructors
//
public XmlValidatingReader( XmlReader reader ) {
impl = new XmlValidatingReaderImpl( reader );
impl.OuterReader = this;
}
public XmlValidatingReader( string xmlFragment, XmlNodeType fragType, XmlParserContext context ) {
impl = new XmlValidatingReaderImpl( xmlFragment, fragType, context );
impl.OuterReader = this;
}
public XmlValidatingReader( Stream xmlFragment, XmlNodeType fragType, XmlParserContext context ) {
impl = new XmlValidatingReaderImpl( xmlFragment, fragType, context );
impl.OuterReader = this;
}
//
// XmlReader members
//
public override XmlReaderSettings Settings {
get { return null; }
}
public override XmlNodeType NodeType {
get { return impl.NodeType; }
}
public override string Name {
get { return impl.Name; }
}
public override string LocalName {
get { return impl.LocalName; }
}
public override string NamespaceURI {
get { return impl.NamespaceURI; }
}
public override string Prefix {
get { return impl.Prefix; }
}
public override bool HasValue {
get { return impl.HasValue; }
}
public override string Value {
get { return impl.Value; }
}
public override int Depth {
get { return impl.Depth; }
}
public override string BaseURI {
get { return impl.BaseURI; }
}
public override bool IsEmptyElement {
get { return impl.IsEmptyElement; }
}
public override bool IsDefault {
get { return impl.IsDefault; }
}
public override char QuoteChar {
get { return impl.QuoteChar; }
}
public override XmlSpace XmlSpace {
get { return impl.XmlSpace; }
}
public override string XmlLang {
get { return impl.XmlLang; }
}
// XmlTextReader does not override SchemaInfo, ValueType and ReadTypeValue
public override int AttributeCount { get { return impl.AttributeCount; } }
public override string GetAttribute( string name ) {
return impl.GetAttribute( name );
}
public override string GetAttribute( string localName, string namespaceURI ) {
return impl.GetAttribute( localName, namespaceURI );
}
public override string GetAttribute( int i ) {
return impl.GetAttribute( i );
}
public override bool MoveToAttribute( string name ) {
return impl.MoveToAttribute( name );
}
public override bool MoveToAttribute( string localName, string namespaceURI ) {
return impl.MoveToAttribute( localName, namespaceURI );
}
public override void MoveToAttribute( int i ) {
impl.MoveToAttribute( i );
}
public override bool MoveToFirstAttribute() {
return impl.MoveToFirstAttribute();
}
public override bool MoveToNextAttribute() {
return impl.MoveToNextAttribute();
}
public override bool MoveToElement() {
return impl.MoveToElement();
}
public override bool ReadAttributeValue() {
return impl.ReadAttributeValue();
}
public override bool Read() {
return impl.Read();
}
public override bool EOF {
get { return impl.EOF; }
}
public override void Close() {
impl.Close();
}
public override ReadState ReadState {
get { return impl.ReadState; }
}
public override XmlNameTable NameTable {
get { return impl.NameTable; }
}
public override String LookupNamespace( String prefix ) {
string ns = impl.LookupNamespace( prefix );
if ( ns != null && ns.Length == 0 ) {
ns = null;
}
return ns;
}
public override bool CanResolveEntity {
get { return true; }
}
public override void ResolveEntity() {
impl.ResolveEntity();
}
// Binary content access methods
public override bool CanReadBinaryContent {
get { return true; }
}
public override int ReadContentAsBase64( byte[] buffer, int index, int count ) {
return impl.ReadContentAsBase64( buffer, index, count );
}
public override int ReadElementContentAsBase64( byte[] buffer, int index, int count ) {
return impl.ReadElementContentAsBase64( buffer, index, count );
}
public override int ReadContentAsBinHex( byte[] buffer, int index, int count ) {
return impl.ReadContentAsBinHex( buffer, index, count );
}
public override int ReadElementContentAsBinHex( byte[] buffer, int index, int count ) {
return impl.ReadElementContentAsBinHex( buffer, index, count );
}
// Overriden helper methods
public override string ReadString() {
impl.MoveOffEntityReference();
return base.ReadString();
}
//
// IXmlLineInfo members
//
public bool HasLineInfo() { return true; }
public int LineNumber { get { return impl.LineNumber; } }
public int LinePosition { get { return impl.LinePosition; } }
//
// IXmlNamespaceResolver members
//
IDictionary IXmlNamespaceResolver.GetNamespacesInScope( XmlNamespaceScope scope ) {
return impl.GetNamespacesInScope( scope );
}
string IXmlNamespaceResolver.LookupNamespace(string prefix) {
return impl.LookupNamespace( prefix );
}
string IXmlNamespaceResolver.LookupPrefix( string namespaceName ) {
return impl.LookupPrefix( namespaceName );
}
//
// XmlValidatingReader
//
public event ValidationEventHandler ValidationEventHandler {
add { impl.ValidationEventHandler += value; }
remove { impl.ValidationEventHandler -= value; }
}
public object SchemaType {
get { return impl.SchemaType; }
}
public XmlReader Reader {
get { return impl.Reader; }
}
public ValidationType ValidationType {
get { return impl.ValidationType; }
set { impl.ValidationType = value; }
}
public XmlSchemaCollection Schemas {
get { return impl.Schemas; }
}
public EntityHandling EntityHandling {
get { return impl.EntityHandling; }
set { impl.EntityHandling = value; }
}
public XmlResolver XmlResolver {
set { impl.XmlResolver = value; }
}
public bool Namespaces {
get { return impl.Namespaces; }
set { impl.Namespaces = value; }
}
public object ReadTypedValue() {
return impl.ReadTypedValue();
}
public Encoding Encoding {
get { return impl.Encoding; }
}
//
// Internal helper methods
//
internal XmlValidatingReaderImpl Impl {
get { return impl; }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
using System;
using System.IO;
using System.Text;
using System.Xml.Schema;
using System.Collections;
using System.Collections.Generic;
using System.Security.Permissions;
namespace System.Xml
{
[PermissionSetAttribute( SecurityAction.InheritanceDemand, Name = "FullTrust" )]
[Obsolete("Use XmlReader created by XmlReader.Create() method using appropriate XmlReaderSettings instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public class XmlValidatingReader : XmlReader, IXmlLineInfo, IXmlNamespaceResolver {
//
// Member fields
//
XmlValidatingReaderImpl impl;
//
// Constructors
//
public XmlValidatingReader( XmlReader reader ) {
impl = new XmlValidatingReaderImpl( reader );
impl.OuterReader = this;
}
public XmlValidatingReader( string xmlFragment, XmlNodeType fragType, XmlParserContext context ) {
impl = new XmlValidatingReaderImpl( xmlFragment, fragType, context );
impl.OuterReader = this;
}
public XmlValidatingReader( Stream xmlFragment, XmlNodeType fragType, XmlParserContext context ) {
impl = new XmlValidatingReaderImpl( xmlFragment, fragType, context );
impl.OuterReader = this;
}
//
// XmlReader members
//
public override XmlReaderSettings Settings {
get { return null; }
}
public override XmlNodeType NodeType {
get { return impl.NodeType; }
}
public override string Name {
get { return impl.Name; }
}
public override string LocalName {
get { return impl.LocalName; }
}
public override string NamespaceURI {
get { return impl.NamespaceURI; }
}
public override string Prefix {
get { return impl.Prefix; }
}
public override bool HasValue {
get { return impl.HasValue; }
}
public override string Value {
get { return impl.Value; }
}
public override int Depth {
get { return impl.Depth; }
}
public override string BaseURI {
get { return impl.BaseURI; }
}
public override bool IsEmptyElement {
get { return impl.IsEmptyElement; }
}
public override bool IsDefault {
get { return impl.IsDefault; }
}
public override char QuoteChar {
get { return impl.QuoteChar; }
}
public override XmlSpace XmlSpace {
get { return impl.XmlSpace; }
}
public override string XmlLang {
get { return impl.XmlLang; }
}
// XmlTextReader does not override SchemaInfo, ValueType and ReadTypeValue
public override int AttributeCount { get { return impl.AttributeCount; } }
public override string GetAttribute( string name ) {
return impl.GetAttribute( name );
}
public override string GetAttribute( string localName, string namespaceURI ) {
return impl.GetAttribute( localName, namespaceURI );
}
public override string GetAttribute( int i ) {
return impl.GetAttribute( i );
}
public override bool MoveToAttribute( string name ) {
return impl.MoveToAttribute( name );
}
public override bool MoveToAttribute( string localName, string namespaceURI ) {
return impl.MoveToAttribute( localName, namespaceURI );
}
public override void MoveToAttribute( int i ) {
impl.MoveToAttribute( i );
}
public override bool MoveToFirstAttribute() {
return impl.MoveToFirstAttribute();
}
public override bool MoveToNextAttribute() {
return impl.MoveToNextAttribute();
}
public override bool MoveToElement() {
return impl.MoveToElement();
}
public override bool ReadAttributeValue() {
return impl.ReadAttributeValue();
}
public override bool Read() {
return impl.Read();
}
public override bool EOF {
get { return impl.EOF; }
}
public override void Close() {
impl.Close();
}
public override ReadState ReadState {
get { return impl.ReadState; }
}
public override XmlNameTable NameTable {
get { return impl.NameTable; }
}
public override String LookupNamespace( String prefix ) {
string ns = impl.LookupNamespace( prefix );
if ( ns != null && ns.Length == 0 ) {
ns = null;
}
return ns;
}
public override bool CanResolveEntity {
get { return true; }
}
public override void ResolveEntity() {
impl.ResolveEntity();
}
// Binary content access methods
public override bool CanReadBinaryContent {
get { return true; }
}
public override int ReadContentAsBase64( byte[] buffer, int index, int count ) {
return impl.ReadContentAsBase64( buffer, index, count );
}
public override int ReadElementContentAsBase64( byte[] buffer, int index, int count ) {
return impl.ReadElementContentAsBase64( buffer, index, count );
}
public override int ReadContentAsBinHex( byte[] buffer, int index, int count ) {
return impl.ReadContentAsBinHex( buffer, index, count );
}
public override int ReadElementContentAsBinHex( byte[] buffer, int index, int count ) {
return impl.ReadElementContentAsBinHex( buffer, index, count );
}
// Overriden helper methods
public override string ReadString() {
impl.MoveOffEntityReference();
return base.ReadString();
}
//
// IXmlLineInfo members
//
public bool HasLineInfo() { return true; }
public int LineNumber { get { return impl.LineNumber; } }
public int LinePosition { get { return impl.LinePosition; } }
//
// IXmlNamespaceResolver members
//
IDictionary IXmlNamespaceResolver.GetNamespacesInScope( XmlNamespaceScope scope ) {
return impl.GetNamespacesInScope( scope );
}
string IXmlNamespaceResolver.LookupNamespace(string prefix) {
return impl.LookupNamespace( prefix );
}
string IXmlNamespaceResolver.LookupPrefix( string namespaceName ) {
return impl.LookupPrefix( namespaceName );
}
//
// XmlValidatingReader
//
public event ValidationEventHandler ValidationEventHandler {
add { impl.ValidationEventHandler += value; }
remove { impl.ValidationEventHandler -= value; }
}
public object SchemaType {
get { return impl.SchemaType; }
}
public XmlReader Reader {
get { return impl.Reader; }
}
public ValidationType ValidationType {
get { return impl.ValidationType; }
set { impl.ValidationType = value; }
}
public XmlSchemaCollection Schemas {
get { return impl.Schemas; }
}
public EntityHandling EntityHandling {
get { return impl.EntityHandling; }
set { impl.EntityHandling = value; }
}
public XmlResolver XmlResolver {
set { impl.XmlResolver = value; }
}
public bool Namespaces {
get { return impl.Namespaces; }
set { impl.Namespaces = value; }
}
public object ReadTypedValue() {
return impl.ReadTypedValue();
}
public Encoding Encoding {
get { return impl.Encoding; }
}
//
// Internal helper methods
//
internal XmlValidatingReaderImpl Impl {
get { return impl; }
}
}
}
// 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
- TextEffect.cs
- EasingQuaternionKeyFrame.cs
- DbDataSourceEnumerator.cs
- WebPartConnectionsDisconnectVerb.cs
- ContainerVisual.cs
- LoginViewDesigner.cs
- ResumeStoryboard.cs
- OleDbPropertySetGuid.cs
- Metafile.cs
- TextAutomationPeer.cs
- ScrollEvent.cs
- HttpRequestCacheValidator.cs
- SelectionPattern.cs
- DateBoldEvent.cs
- IxmlLineInfo.cs
- ContextStaticAttribute.cs
- TimeZone.cs
- AppendHelper.cs
- Primitive.cs
- HoistedLocals.cs
- Assembly.cs
- PersonalizableAttribute.cs
- XmlTypeAttribute.cs
- ValidationError.cs
- EdmComplexPropertyAttribute.cs
- autovalidator.cs
- TypeSystem.cs
- WebEventTraceProvider.cs
- ButtonBase.cs
- QueryExpr.cs
- URI.cs
- HtmlLink.cs
- DelegateBodyWriter.cs
- XmlSerializerAssemblyAttribute.cs
- LineServicesCallbacks.cs
- UIPropertyMetadata.cs
- MetabaseSettingsIis7.cs
- WindowsComboBox.cs
- InstanceDataCollectionCollection.cs
- DelegatingTypeDescriptionProvider.cs
- ECDsaCng.cs
- WebPartAuthorizationEventArgs.cs
- SendSecurityHeader.cs
- BooleanProjectedSlot.cs
- AnnotationDocumentPaginator.cs
- WebServicesInteroperability.cs
- AppSettingsReader.cs
- InheritedPropertyDescriptor.cs
- IPGlobalProperties.cs
- DataListItemEventArgs.cs
- SoapReflectionImporter.cs
- IdentityModelStringsVersion1.cs
- TransformDescriptor.cs
- MenuScrollingVisibilityConverter.cs
- BinarySerializer.cs
- Ray3DHitTestResult.cs
- XmlSchemaDatatype.cs
- AttributeTableBuilder.cs
- WaitForChangedResult.cs
- Error.cs
- OneOfConst.cs
- Quaternion.cs
- MemberBinding.cs
- QuestionEventArgs.cs
- CollectionViewSource.cs
- Paragraph.cs
- MemberRelationshipService.cs
- WebAdminConfigurationHelper.cs
- TimeSpanConverter.cs
- EventMappingSettings.cs
- GenericTextProperties.cs
- HuffCodec.cs
- LogFlushAsyncResult.cs
- DropDownButton.cs
- mediaeventshelper.cs
- Walker.cs
- DataGridViewColumnHeaderCell.cs
- CommonRemoteMemoryBlock.cs
- IdleTimeoutMonitor.cs
- MethodImplAttribute.cs
- DefaultMemberAttribute.cs
- AlignmentXValidation.cs
- MessageFilterTable.cs
- MasterPageBuildProvider.cs
- ResourceExpressionEditor.cs
- PriorityQueue.cs
- MenuBase.cs
- RenamedEventArgs.cs
- RectangleConverter.cs
- MobileCapabilities.cs
- OneOfTypeConst.cs
- Wildcard.cs
- RolePrincipal.cs
- ControlBuilderAttribute.cs
- ECDsa.cs
- XmlNode.cs
- DataControlLinkButton.cs
- InputBinding.cs
- ElementInit.cs
- SiteMembershipCondition.cs