当前位置: 首页>>代码示例>>C#>>正文


C# XmlStandalone类代码示例

本文整理汇总了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;
            }
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:60,代码来源:QueryOutputWriterV1.cs

示例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);
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:28,代码来源:XmlEncodedRawTextWriterAsync.cs

示例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;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:46,代码来源:QueryOutputWriterV1.cs

示例4: WriteXmlDeclaration

        //-----------------------------------------------
        // XmlRawWriter interface
        //-----------------------------------------------

        internal override void WriteXmlDeclaration(XmlStandalone standalone) {
            AddEvent(XmlEventType.XmlDecl1, (object) standalone);
        }
开发者ID:uQr,项目名称:referencesource,代码行数:7,代码来源:XmlEventCache.cs

示例5: WriteXmlDeclaration

 internal override void WriteXmlDeclaration(XmlStandalone standalone) {
     // Forces xml writer to be created
     EnsureWrappedWriter(XmlOutputMethod.Xml);
     this.wrapped.WriteXmlDeclaration(standalone);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:XmlAutoDetectWriter.cs

示例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 ) {

        }
开发者ID:uQr,项目名称:referencesource,代码行数:5,代码来源:XmlRawWriter.cs

示例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;

        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:11,代码来源:XmlRawWriterAsync.cs

示例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("\"?>");
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:XmlEncodedRawTextWriter.cs

示例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;
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:27,代码来源:XmlWellformedWriter.cs

示例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;
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:30,代码来源:XmlWriterSettings.cs

示例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;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:26,代码来源:xmlwritersettings.cs

示例12: WriteXmlDeclaration

 internal override void WriteXmlDeclaration(XmlStandalone standalone)
 {
     this.EnsureWrappedWriter(XmlOutputMethod.Xml);
     this.wrapped.WriteXmlDeclaration(standalone);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:XmlAutoDetectWriter.cs

示例13: WriteXmlDeclaration

 internal override void WriteXmlDeclaration(XmlStandalone standalone)
 {
     // Ignore xml declaration
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:4,代码来源:HtmlUtf8RawTextWriter.cs

示例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);
     }
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:DocumentXmlWriter.cs

示例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
        }
开发者ID:Corillian,项目名称:corefx,代码行数:11,代码来源:XPathDocumentBuilder.cs


注:本文中的XmlStandalone类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。