Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / CommandTrees / Internal / XmlExpressionDumper.cs / 1305376 / XmlExpressionDumper.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Xml;
using System.Data.Metadata.Edm;
using System.Data.Common.CommandTrees;
namespace System.Data.Common.CommandTrees.Internal
{
///
/// An implementation of ExpressionDumper that produces an XML string.
///
internal class XmlExpressionDumper : ExpressionDumper
{
internal static Encoding DefaultEncoding { get { return Encoding.UTF8; } }
private XmlWriter _writer;
internal XmlExpressionDumper(Stream stream)
: this(stream, XmlExpressionDumper.DefaultEncoding, true) {}
internal XmlExpressionDumper(Stream stream, Encoding encoding, bool indent) : base()
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.CheckCharacters = false;
settings.Indent = true;
settings.Encoding = encoding;
_writer = XmlWriter.Create(stream, settings);
_writer.WriteStartDocument(true);
}
internal void Close()
{
_writer.WriteEndDocument();
_writer.Flush();
_writer.Close();
}
internal override void Begin(string name, Dictionary attrs)
{
_writer.WriteStartElement(name);
if (attrs != null)
{
foreach (KeyValuePair attr in attrs)
{
_writer.WriteAttributeString(attr.Key, (null == attr.Value ? "" : attr.Value.ToString()));
}
}
}
internal override void End(string name)
{
_writer.WriteEndElement();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Xml;
using System.Data.Metadata.Edm;
using System.Data.Common.CommandTrees;
namespace System.Data.Common.CommandTrees.Internal
{
///
/// An implementation of ExpressionDumper that produces an XML string.
///
internal class XmlExpressionDumper : ExpressionDumper
{
internal static Encoding DefaultEncoding { get { return Encoding.UTF8; } }
private XmlWriter _writer;
internal XmlExpressionDumper(Stream stream)
: this(stream, XmlExpressionDumper.DefaultEncoding, true) {}
internal XmlExpressionDumper(Stream stream, Encoding encoding, bool indent) : base()
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.CheckCharacters = false;
settings.Indent = true;
settings.Encoding = encoding;
_writer = XmlWriter.Create(stream, settings);
_writer.WriteStartDocument(true);
}
internal void Close()
{
_writer.WriteEndDocument();
_writer.Flush();
_writer.Close();
}
internal override void Begin(string name, Dictionary attrs)
{
_writer.WriteStartElement(name);
if (attrs != null)
{
foreach (KeyValuePair attr in attrs)
{
_writer.WriteAttributeString(attr.Key, (null == attr.Value ? "" : attr.Value.ToString()));
}
}
}
internal override void End(string name)
{
_writer.WriteEndElement();
}
}
}
// 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
- FormatConvertedBitmap.cs
- RoutedEventValueSerializer.cs
- XmlLanguage.cs
- HttpCookiesSection.cs
- ContextItem.cs
- Literal.cs
- IResourceProvider.cs
- PageBreakRecord.cs
- CollectionView.cs
- Annotation.cs
- GB18030Encoding.cs
- DescendentsWalkerBase.cs
- HttpModuleCollection.cs
- ServiceDescriptionImporter.cs
- ThreadSafeList.cs
- DocumentSequenceHighlightLayer.cs
- NavigatorOutput.cs
- SafeArchiveContext.cs
- NeutralResourcesLanguageAttribute.cs
- _emptywebproxy.cs
- HMACSHA1.cs
- MetadataFile.cs
- HttpResponseHeader.cs
- ListItemCollection.cs
- PostBackOptions.cs
- ByteStreamGeometryContext.cs
- Rotation3DKeyFrameCollection.cs
- RequiredAttributeAttribute.cs
- DataSetViewSchema.cs
- CustomErrorsSectionWrapper.cs
- OleDbErrorCollection.cs
- RequestValidator.cs
- Transform3DGroup.cs
- ByteStorage.cs
- EntityWrapperFactory.cs
- DocumentPage.cs
- TraceData.cs
- Query.cs
- BuildManager.cs
- CorruptingExceptionCommon.cs
- CardSpaceException.cs
- IgnorePropertiesAttribute.cs
- FormatException.cs
- XmlException.cs
- Timer.cs
- TextSelectionHelper.cs
- NativeMethods.cs
- ReadOnlyNameValueCollection.cs
- TextServicesContext.cs
- ServiceOperation.cs
- mactripleDES.cs
- Visitor.cs
- DesignerHost.cs
- MouseDevice.cs
- GridViewRow.cs
- DrawingContextWalker.cs
- TreeNode.cs
- ResXResourceWriter.cs
- _SslSessionsCache.cs
- StateRuntime.cs
- HtmlInputButton.cs
- UnsafeNativeMethods.cs
- BinaryFormatter.cs
- Rect.cs
- QilName.cs
- odbcmetadatafactory.cs
- SQLSingleStorage.cs
- ButtonChrome.cs
- ConnectionProviderAttribute.cs
- XmlUnspecifiedAttribute.cs
- VerificationException.cs
- DrawingContextDrawingContextWalker.cs
- EventToken.cs
- FactoryGenerator.cs
- SpellerStatusTable.cs
- ObjectIDGenerator.cs
- RightsManagementPermission.cs
- Query.cs
- DataGridViewComboBoxColumn.cs
- ObjectSet.cs
- TextAutomationPeer.cs
- EasingKeyFrames.cs
- TdsValueSetter.cs
- SqlNotificationRequest.cs
- ImageSourceConverter.cs
- QilFunction.cs
- ObjectDataSourceFilteringEventArgs.cs
- XPathParser.cs
- SkinBuilder.cs
- PropertyEntry.cs
- DefaultPropertyAttribute.cs
- MemoryStream.cs
- TransportChannelListener.cs
- BinaryObjectInfo.cs
- WebColorConverter.cs
- ClassHandlersStore.cs
- EncryptedPackage.cs
- ListViewItemEventArgs.cs
- WebPartAuthorizationEventArgs.cs
- ContextQuery.cs