本文整理汇总了C#中XmlStandalone类的典型用法代码示例。如果您正苦于以下问题:C# XmlStandalone类的具体用法?C# XmlStandalone怎么用?C# XmlStandalone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlStandalone类属于命名空间,在下文中一共展示了XmlStandalone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueryOutputWriterV1
public QueryOutputWriterV1(XmlWriter writer, XmlWriterSettings settings)
{
_wrapped = writer;
_systemId = settings.DocTypeSystem;
_publicId = settings.DocTypePublic;
if (settings.OutputMethod == XmlOutputMethod.Xml)
{
bool documentConformance = false;
// Xml output method shouldn't output doc-type-decl if system ID is not defined (even if public ID is)
// Only check for well-formed document if output method is xml
if (_systemId != null)
{
documentConformance = true;
_outputDocType = true;
}
// Check for well-formed document if standalone="yes" in an auto-generated xml declaration
if (settings.Standalone == XmlStandalone.Yes)
{
documentConformance = true;
_standalone = settings.Standalone;
}
if (documentConformance)
{
if (settings.Standalone == XmlStandalone.Yes)
{
_wrapped.WriteStartDocument(true);
}
else
{
_wrapped.WriteStartDocument();
}
}
if (settings.CDataSectionElements != null && settings.CDataSectionElements.Count > 0)
{
_bitsCData = new BitStack();
_lookupCDataElems = new Dictionary<XmlQualifiedName, XmlQualifiedName>();
_qnameCData = new XmlQualifiedName();
// Add each element name to the lookup table
foreach (XmlQualifiedName name in settings.CDataSectionElements)
{
_lookupCDataElems[name] = null;
}
_bitsCData.PushBit(false);
}
}
else if (settings.OutputMethod == XmlOutputMethod.Html)
{
// Html output method should output doc-type-decl if system ID or public ID is defined
if (_systemId != null || _publicId != null)
_outputDocType = true;
}
}
示例2: WriteXmlDeclarationAsync
// Write the xml declaration. This must be the first call.
internal override async Task WriteXmlDeclarationAsync( XmlStandalone standalone ) {
CheckAsyncCall();
// Output xml declaration only if user allows it and it was not already output
if ( !omitXmlDeclaration && !autoXmlDeclaration ) {
if ( trackTextContent && inTextContent != false ) { ChangeTextContentMark( false ); }
await RawTextAsync( "<?xml version=\"" ).ConfigureAwait(false);
// Version
await RawTextAsync( "1.0" ).ConfigureAwait(false);
// Encoding
if ( encoding != null ) {
await RawTextAsync( "\" encoding=\"" ).ConfigureAwait(false);
await RawTextAsync( encoding.WebName ).ConfigureAwait(false);
}
// Standalone
if ( standalone != XmlStandalone.Omit ) {
await RawTextAsync( "\" standalone=\"" ).ConfigureAwait(false);
await RawTextAsync( standalone == XmlStandalone.Yes ? "yes" : "no" ).ConfigureAwait(false);
}
await RawTextAsync( "\"?>" ).ConfigureAwait(false);
}
}
示例3: QueryOutputWriterV1
public QueryOutputWriterV1(XmlWriter writer, XmlWriterSettings settings)
{
this.wrapped = writer;
this.systemId = settings.DocTypeSystem;
this.publicId = settings.DocTypePublic;
if (settings.OutputMethod == XmlOutputMethod.Xml)
{
bool flag = false;
if (this.systemId != null)
{
flag = true;
this.outputDocType = true;
}
if (settings.Standalone == XmlStandalone.Yes)
{
flag = true;
this.standalone = settings.Standalone;
}
if (flag)
{
if (settings.Standalone == XmlStandalone.Yes)
{
this.wrapped.WriteStartDocument(true);
}
else
{
this.wrapped.WriteStartDocument();
}
}
if ((settings.CDataSectionElements != null) && (settings.CDataSectionElements.Count > 0))
{
this.bitsCData = new BitStack();
this.lookupCDataElems = new Dictionary<XmlQualifiedName, XmlQualifiedName>();
this.qnameCData = new XmlQualifiedName();
foreach (XmlQualifiedName name in settings.CDataSectionElements)
{
this.lookupCDataElems[name] = null;
}
this.bitsCData.PushBit(false);
}
}
else if ((settings.OutputMethod == XmlOutputMethod.Html) && ((this.systemId != null) || (this.publicId != null)))
{
this.outputDocType = true;
}
}
示例4: WriteXmlDeclaration
//-----------------------------------------------
// XmlRawWriter interface
//-----------------------------------------------
internal override void WriteXmlDeclaration(XmlStandalone standalone) {
AddEvent(XmlEventType.XmlDecl1, (object) standalone);
}
示例5: WriteXmlDeclaration
internal override void WriteXmlDeclaration(XmlStandalone standalone) {
// Forces xml writer to be created
EnsureWrappedWriter(XmlOutputMethod.Xml);
this.wrapped.WriteXmlDeclaration(standalone);
}
示例6: WriteXmlDeclaration
// Write the xml declaration. This must be the first call.
#if !SILVERLIGHT // This code is not being hit in Silverlight
internal virtual void WriteXmlDeclaration( XmlStandalone standalone ) {
}
示例7: WriteXmlDeclarationAsync
//
// XmlRawWriter methods and properties
//
// Write the xml declaration. This must be the first call.
#if !SILVERLIGHT || ASYNC // This code is not being hit in Silverlight, but is used on desktop and in CoreSys builds.
internal virtual Task WriteXmlDeclarationAsync( XmlStandalone standalone ) {
return AsyncHelper.DoneTask;
}
示例8: WriteXmlDeclaration
internal override void WriteXmlDeclaration(XmlStandalone standalone)
{
if (!this.omitXmlDeclaration && !this.autoXmlDeclaration)
{
if (this.trackTextContent && this.inTextContent)
{
this.ChangeTextContentMark(false);
}
this.RawText("<?xml version=\"");
this.RawText("1.0");
if (this.encoding != null)
{
this.RawText("\" encoding=\"");
this.RawText(this.encoding.WebName);
}
if (standalone != XmlStandalone.Omit)
{
this.RawText("\" standalone=\"");
this.RawText((standalone == XmlStandalone.Yes) ? "yes" : "no");
}
this.RawText("\"?>");
}
}
示例9: WriteStartDocumentImpl
private void WriteStartDocumentImpl(XmlStandalone standalone) {
try {
AdvanceState(Token.StartDocument);
if (conformanceLevel == ConformanceLevel.Auto) {
conformanceLevel = ConformanceLevel.Document;
stateTable = StateTableDocument;
}
else if (conformanceLevel == ConformanceLevel.Fragment) {
throw new InvalidOperationException(Res.GetString(Res.Xml_CannotStartDocumentOnFragment));
}
if (rawWriter != null) {
if (!xmlDeclFollows) {
rawWriter.WriteXmlDeclaration(standalone);
}
}
else {
// We do not pass the standalone value here - Dev10 Bug #479769
writer.WriteStartDocument();
}
}
catch {
currentState = State.Error;
throw;
}
}
示例10: Initialize
//
// Private methods
//
private void Initialize()
{
_encoding = Encoding.UTF8;
_omitXmlDecl = false;
_newLineHandling = NewLineHandling.Replace;
_newLineChars = Environment.NewLine; // "\r\n" on Windows, "\n" on Unix
_indent = TriState.Unknown;
_indentChars = " ";
_newLineOnAttributes = false;
_closeOutput = false;
_namespaceHandling = NamespaceHandling.Default;
_conformanceLevel = ConformanceLevel.Document;
_checkCharacters = true;
_writeEndDocumentOnClose = true;
_outputMethod = XmlOutputMethod.Xml;
_cdataSections.Clear();
_mergeCDataSections = false;
_mediaType = null;
_docTypeSystem = null;
_docTypePublic = null;
_standalone = XmlStandalone.Omit;
_doNotEscapeUriAttributes = false;
_useAsync = false;
_isReadOnly = false;
}
示例11: Reset
//
// Public methods
//
public void Reset() {
encoding = Encoding.UTF8;
omitXmlDecl = false;
newLineHandling = NewLineHandling.Replace;
newLineChars = "\r\n";
indent = TriState.Unknown;
indentChars = " ";
newLineOnAttributes = false;
closeOutput = false;
conformanceLevel = ConformanceLevel.Document;
checkCharacters = true;
outputMethod = XmlOutputMethod.Xml;
cdataSections = null;
mergeCDataSections = false;
mediaType = null;
docTypeSystem = null;
docTypePublic = null;
standalone = XmlStandalone.Omit;
isReadOnly = false;
}
示例12: WriteXmlDeclaration
internal override void WriteXmlDeclaration(XmlStandalone standalone)
{
this.EnsureWrappedWriter(XmlOutputMethod.Xml);
this.wrapped.WriteXmlDeclaration(standalone);
}
示例13: WriteXmlDeclaration
internal override void WriteXmlDeclaration(XmlStandalone standalone)
{
// Ignore xml declaration
}
示例14: WriteXmlDeclaration
internal override void WriteXmlDeclaration(XmlStandalone standalone)
{
VerifyState(Method.WriteXmlDeclaration);
if (standalone != XmlStandalone.Omit)
{
XmlNode node = _document.CreateXmlDeclaration("1.0", string.Empty, standalone == XmlStandalone.Yes ? "yes" : "no");
AddChild(node, _write);
}
}
示例15: WriteXmlDeclaration
//-----------------------------------------------
// XmlRawWriter interface
//-----------------------------------------------
/// <summary>
/// Write the xml declaration. This must be the first call after Open.
/// </summary>
internal override void WriteXmlDeclaration(XmlStandalone standalone)
{
// Ignore the xml declaration when building the cache
}