Manages a stack of bits. Exposes push, pop, and peek operations.
示例#1
1
        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;
            }
        }
 public QueryOutputWriter(XmlRawWriter writer, XmlWriterSettings settings)
 {
     this.wrapped  = writer;
     this.systemId = settings.DocTypeSystem;
     this.publicId = settings.DocTypePublic;
     if (settings.OutputMethod == XmlOutputMethod.Xml)
     {
         if (this.systemId != null)
         {
             this.outputDocType      = true;
             this.checkWellFormedDoc = true;
         }
         if (settings.AutoXmlDeclaration && (settings.Standalone == XmlStandalone.Yes))
         {
             this.checkWellFormedDoc = true;
         }
         if (settings.CDataSectionElements.Count > 0)
         {
             this.bitsCData        = new BitStack();
             this.lookupCDataElems = new Dictionary <XmlQualifiedName, int>();
             this.qnameCData       = new XmlQualifiedName();
             foreach (XmlQualifiedName name in settings.CDataSectionElements)
             {
                 this.lookupCDataElems[name] = 0;
             }
             this.bitsCData.PushBit(false);
         }
     }
     else if ((settings.OutputMethod == XmlOutputMethod.Html) && ((this.systemId != null) || (this.publicId != null)))
     {
         this.outputDocType = true;
     }
 }
 public QueryOutputWriter(XmlRawWriter writer, XmlWriterSettings settings)
 {
     this.wrapped = writer;
     this.systemId = settings.DocTypeSystem;
     this.publicId = settings.DocTypePublic;
     if (settings.OutputMethod == XmlOutputMethod.Xml)
     {
         if (this.systemId != null)
         {
             this.outputDocType = true;
             this.checkWellFormedDoc = true;
         }
         if (settings.AutoXmlDeclaration && (settings.Standalone == XmlStandalone.Yes))
         {
             this.checkWellFormedDoc = true;
         }
         if (settings.CDataSectionElements.Count > 0)
         {
             this.bitsCData = new BitStack();
             this.lookupCDataElems = new Dictionary<XmlQualifiedName, int>();
             this.qnameCData = new XmlQualifiedName();
             foreach (XmlQualifiedName name in settings.CDataSectionElements)
             {
                 this.lookupCDataElems[name] = 0;
             }
             this.bitsCData.PushBit(false);
         }
     }
     else if ((settings.OutputMethod == XmlOutputMethod.Html) && ((this.systemId != null) || (this.publicId != null)))
     {
         this.outputDocType = true;
     }
 }
示例#4
0
        public QueryOutputWriter(XmlRawWriter writer, XmlWriterSettings settings)
        {
            this.wrapped = writer;

            this.systemId = settings.DocTypeSystem;
            this.publicId = settings.DocTypePublic;

            if (settings.OutputMethod == XmlOutputMethod.Xml)
            {
                // 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 (this.systemId != null)
                {
                    this.outputDocType      = true;
                    this.checkWellFormedDoc = true;
                }

                // Check for well-formed document if standalone="yes" in an auto-generated xml declaration
                if (settings.AutoXmlDeclaration && settings.Standalone == XmlStandalone.Yes)
                {
                    this.checkWellFormedDoc = true;
                }

                this.listCDataElems = settings.CDataSectionElements;
                if (this.listCDataElems != null)
                {
                    this.bitsCData        = new BitStack();
                    this.lookupCDataElems = new Hashtable();
                    this.qnameCData       = new XmlQualifiedName();

                    // Add each element name to the lookup table
                    foreach (object name in this.listCDataElems)
                    {
                        if (name is string)
                        {
                            XmlQualifiedName qname = new XmlQualifiedName(name as string, "");
                            this.lookupCDataElems[qname] = qname;
                        }
                        else
                        {
                            Debug.Assert(name is XmlQualifiedName);
                            this.lookupCDataElems[name] = name;
                        }
                    }

                    this.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 (this.systemId != null || this.publicId != null)
                {
                    this.outputDocType = true;
                }
            }
        }
        private WhitespaceRuleReader(XmlReader baseReader, WhitespaceRuleLookup wsRules) : base(baseReader) {
            Debug.Assert(wsRules != null);

            this.val = null;
            this.stkStrip = new BitStack();
            this.shouldStrip = false;
            this.preserveAdjacent = false;

            this.wsRules = wsRules;
            this.wsRules.Atomize(baseReader.NameTable);
        }
示例#6
0
        public QueryOutputWriter(XmlRawWriter writer, XmlWriterSettings settings)
        {
            _wrapped = writer;

            _systemId = settings.DocTypeSystem;
            _publicId = settings.DocTypePublic;

            if (settings.OutputMethod == XmlOutputMethod.Xml)
            {
                // 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)
                {
                    _outputDocType      = true;
                    _checkWellFormedDoc = true;
                }

                // Check for well-formed document if standalone="yes" in an auto-generated xml declaration
                if (settings.AutoXmlDeclaration && settings.Standalone == XmlStandalone.Yes)
                {
                    _checkWellFormedDoc = true;
                }

                if (settings.CDataSectionElements.Count > 0)
                {
                    _bitsCData        = new BitStack();
                    _lookupCDataElems = new Dictionary <XmlQualifiedName, int>();
                    _qnameCData       = new XmlQualifiedName();

                    // Add each element name to the lookup table
                    foreach (XmlQualifiedName name in settings.CDataSectionElements)
                    {
                        _lookupCDataElems[name] = 0;
                    }

                    _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;
                }
            }
        }
示例#7
0
 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;
     }
 }
 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;
     }
 }
        public QueryOutputWriter(XmlRawWriter writer, XmlWriterSettings settings) {
            this.wrapped = writer;

            this.systemId = settings.DocTypeSystem;
            this.publicId = settings.DocTypePublic;

            if (settings.OutputMethod == XmlOutputMethod.Xml) {
                // 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 (this.systemId != null) {
                    this.outputDocType = true;
                    this.checkWellFormedDoc = true;
                }

                // Check for well-formed document if standalone="yes" in an auto-generated xml declaration
                if (settings.AutoXmlDeclaration && settings.Standalone == XmlStandalone.Yes)
                    this.checkWellFormedDoc = true;

                this.listCDataElems = settings.CDataSectionElements;
                if (this.listCDataElems != null) {
                    this.bitsCData = new BitStack();
                    this.lookupCDataElems = new Hashtable();
                    this.qnameCData = new XmlQualifiedName();

                    // Add each element name to the lookup table
                    foreach (object name in this.listCDataElems) {
                        if (name is string) {
                            XmlQualifiedName qname = new XmlQualifiedName(name as string, "");
                            this.lookupCDataElems[qname] = qname;
                        }
                        else {
                            Debug.Assert(name is XmlQualifiedName);
                            this.lookupCDataElems[name] = name;
                        }
                    }

                    this.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 (this.systemId != null || this.publicId != null)
                    this.outputDocType = true;
            }
        }
 private void Init(XmlWriterSettings settings)
 {
     this.indentLevel         = 0;
     this.indentChars         = settings.IndentChars;
     this.newLineOnAttributes = settings.NewLineOnAttributes;
     this.mixedContentStack   = new BitStack();
     if (base.checkCharacters)
     {
         if (this.newLineOnAttributes)
         {
             base.ValidateContentChars(this.indentChars, "IndentChars", true);
             base.ValidateContentChars(base.newLineChars, "NewLineChars", true);
         }
         else
         {
             base.ValidateContentChars(this.indentChars, "IndentChars", false);
             if (base.newLineHandling != NewLineHandling.Replace)
             {
                 base.ValidateContentChars(base.newLineChars, "NewLineChars", false);
             }
         }
     }
 }
 private void Init(XmlWriterSettings settings)
 {
     this.indentLevel = 0;
     this.indentChars = settings.IndentChars;
     this.newLineOnAttributes = settings.NewLineOnAttributes;
     this.mixedContentStack = new BitStack();
     if (base.checkCharacters)
     {
         if (this.newLineOnAttributes)
         {
             base.ValidateContentChars(this.indentChars, "IndentChars", true);
             base.ValidateContentChars(base.newLineChars, "NewLineChars", true);
         }
         else
         {
             base.ValidateContentChars(this.indentChars, "IndentChars", false);
             if (base.newLineHandling != NewLineHandling.Replace)
             {
                 base.ValidateContentChars(base.newLineChars, "NewLineChars", false);
             }
         }
     }
 }
示例#12
0
        public QueryOutputWriterV1(XmlWriter writer, XmlWriterSettings settings)
        {
            this.wrapped = writer;

            this.systemId = settings.DocTypeSystem;
            this.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 (this.systemId != null)
                {
                    documentConformance = true;
                    this.outputDocType  = true;
                }

                // Check for well-formed document if standalone="yes" in an auto-generated xml declaration
                if (settings.Standalone == XmlStandalone.Yes)
                {
                    documentConformance = true;
                    this.standalone     = settings.Standalone;
                }

                if (documentConformance)
                {
                    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();

                    // Add each element name to the lookup table
                    foreach (XmlQualifiedName name in settings.CDataSectionElements)
                    {
                        this.lookupCDataElems[name] = null;
                    }

                    this.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 (this.systemId != null || this.publicId != null)
                {
                    this.outputDocType = true;
                }
            }
        }
//
// Private methods
//
        private void Init( XmlWriterSettings settings ) {
            indentLevel = 0;
            indentChars = settings.IndentChars;
            newLineOnAttributes = settings.NewLineOnAttributes;
            mixedContentStack = new BitStack();

            // check indent characters that they are valid XML characters
            if ( base.checkCharacters ) {
                if ( newLineOnAttributes ) {
                    base.ValidateContentChars( indentChars, "IndentChars", true );
                    base.ValidateContentChars( newLineChars, "NewLineChars", true );
                }
                else {
                    base.ValidateContentChars( indentChars, "IndentChars", false );
                    if ( base.newLineHandling != NewLineHandling.Replace ) {
                        base.ValidateContentChars( newLineChars, "NewLineChars", false );
                    }
                }
            }
        }