System.Xml.QueryOutputWriter.QueryOutputWriter C# (CSharp) Méthode

QueryOutputWriter() public méthode

public QueryOutputWriter ( XmlRawWriter writer, XmlWriterSettings settings ) : System
writer XmlRawWriter
settings XmlWriterSettings
Résultat System
        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;
            }
        }