• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# XmlStandalone类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中XmlStandalone的典型用法代码示例。如果您正苦于以下问题:C# XmlStandalone类的具体用法?C# XmlStandalone怎么用?C# XmlStandalone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlStandalone类属于命名空间,在下文中一共展示了XmlStandalone类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: WriteXmlDeclaration

 /// <summary>
 /// Write the xml declaration.  This must be the first call.
 /// </summary>
 internal override void WriteXmlDeclaration(XmlStandalone standalone) {
     this.wrapped.WriteXmlDeclaration(standalone);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:6,代码来源:QueryOutputWriter.cs


示例17: WriteXmlDeclaration

        // Write the xml declaration.  This must be the first call.  
        internal override void WriteXmlDeclaration( XmlStandalone standalone ) {
            // Output xml declaration only if user allows it and it was not already output
            if ( !omitXmlDeclaration && !autoXmlDeclaration ) {

                

                RawText( "<?xml version=\"" );

                // Version
                RawText( "1.0" );

                // Encoding
                if ( encoding != null ) {
                    RawText( "\" encoding=\"" );
                    RawText( ( encoding.CodePage == 1201 ) ? "UTF-16BE" : encoding.WebName );
                }

                // Standalone
                if ( standalone != XmlStandalone.Omit ) {
                    RawText( "\" standalone=\"" );
                    RawText( standalone == XmlStandalone.Yes ? "yes" : "no" );
                }

                RawText( "\"?>" );
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:27,代码来源:xmlutf8rawtextwriter.cs


示例18: WriteXmlDeclaration

        // Write the xml declaration.  This must be the first call.  
        internal override void WriteXmlDeclaration( XmlStandalone standalone ) {
            // Output xml declaration only if user allows it and it was not already output
            if ( !omitXmlDeclaration && !autoXmlDeclaration ) {

                if ( trackTextContent && inTextContent != false ) { ChangeTextContentMark( false ); }

                RawText( "<?xml version=\"" );

                // Version
                RawText( "1.0" );

                // Encoding
                if ( encoding != null ) {
                    RawText( "\" encoding=\"" );
                    RawText( encoding.WebName );
                }

                // Standalone
                if ( standalone != XmlStandalone.Omit ) {
                    RawText( "\" standalone=\"" );
                    RawText( standalone == XmlStandalone.Yes ? "yes" : "no" );
                }

                RawText( "\"?>" );
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:27,代码来源:XmlEncodedRawTextWriter.cs


示例19: WriteStartDocumentImplAsync

        private async Task WriteStartDocumentImplAsync(XmlStandalone standalone) {
            try {
                await AdvanceStateAsync(Token.StartDocument).ConfigureAwait(false);

                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) {
                        await rawWriter.WriteXmlDeclarationAsync(standalone).ConfigureAwait(false);
                    }
                }
                else {
                    // We do not pass the standalone value here - Dev10 
                    await writer.WriteStartDocumentAsync().ConfigureAwait(false);
                }
            }
            catch {
                currentState = State.Error;
                throw;
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:27,代码来源:XmlWellFormedWriterAsync.cs


示例20: Initialize

//
// Private methods
//
        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;

#if !SILVERLIGHT
            outputMethod = XmlOutputMethod.Xml;
            cdataSections.Clear();
            mergeCDataSections = false;
            mediaType = null;
            docTypeSystem = null;
            docTypePublic = null;
            standalone = XmlStandalone.Omit;
            doNotEscapeUriAttributes = false;
#endif

#if ASYNC || FEATURE_NETCORE
            useAsync = false;
#endif
            isReadOnly = false;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:33,代码来源:XmlWriterSettings.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# XmlTextReader类代码示例发布时间:2022-05-24
下一篇:
C# XmlSpace类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap