Inheritance: SequentialOutput
Beispiel #1
0
        public override string ReadInnerXml()
        {
            if (ReadState == ReadState.Interactive)
            {
                if (NodeType == XmlNodeType.Element && !IsEmptyElement)
                {
                    StringOutput output = new StringOutput(this.processor);
                    output.OmitXmlDecl();
                    int depth = Depth;

                    Read();                 // skeep  begin Element
                    while (depth < Depth)   // process content
                    {
                        Debug.Assert(this.builder != null);
                        output.RecordDone(this.builder);
                        Read();
                    }
                    Debug.Assert(NodeType == XmlNodeType.EndElement);
                    Read();                 // skeep end element

                    output.TheEnd();
                    return(output.Result);
                }
                else if (NodeType == XmlNodeType.Attribute)
                {
                    return(encoder.AtributeInnerXml(Value));
                }
                else
                {
                    Read();
                }
            }
            return(string.Empty);
        }
Beispiel #2
0
        public override string ReadOuterXml()
        {
            if (ReadState == ReadState.Interactive)
            {
                if (NodeType == XmlNodeType.Element)
                {
                    StringOutput output = new StringOutput(this.processor);
                    output.OmitXmlDecl();
                    bool emptyElement = IsEmptyElement;
                    int  depth        = Depth;
                    // process current record
                    output.RecordDone(this.builder);
                    Read();
                    // process internal elements & text nodes
                    while (depth < Depth)
                    {
                        Debug.Assert(this.builder != null);
                        output.RecordDone(this.builder);
                        Read();
                    }
                    // process end element
                    if (!emptyElement)
                    {
                        output.RecordDone(this.builder);
                        Read();
                    }

                    output.TheEnd();
                    return(output.Result);
                }
                else if (NodeType == XmlNodeType.Attribute)
                {
                    return(encoder.AtributeOuterXml(Name, Value));
                }
                else
                {
                    Read();
                }
            }
            return(string.Empty);
        }
        public override string ReadOuterXml() {
            if (ReadState == ReadState.Interactive) {
                if (NodeType == XmlNodeType.Element) {
                    StringOutput output = new StringOutput(this.processor);
                    output.OmitXmlDecl();
                    bool emptyElement = IsEmptyElement;
                    int  depth        = Depth;
                    // process current record
                    output.RecordDone(this.builder); 
                    Read();                          
                    // process internal elements & text nodes
                    while(depth < Depth) {                      
                        Debug.Assert(this.builder != null);
                        output.RecordDone(this.builder);
                        Read();
                    }
                    // process end element
                    if (! emptyElement) {
                        output.RecordDone(this.builder);            
                        Read();
                    }

                    output.TheEnd();
                    return output.Result; 
                }
                else if(NodeType == XmlNodeType.Attribute) {
                    return encoder.AtributeOuterXml(Name, Value);
                }
                else {
                    Read();
                }
            }
            return string.Empty;
        }
        public override string ReadInnerXml() {
            if (ReadState == ReadState.Interactive) {
                if (NodeType == XmlNodeType.Element && ! IsEmptyElement) {
                    StringOutput output = new StringOutput(this.processor);
                    output.OmitXmlDecl();
                    int depth = Depth;

                    Read();                 // skeep  begin Element
                    while (depth < Depth) { // process content
                        Debug.Assert(this.builder != null);
                        output.RecordDone(this.builder);
                        Read();
                    }
                    Debug.Assert(NodeType == XmlNodeType.EndElement);
                    Read();                 // skeep end element

                    output.TheEnd();
                    return output.Result;
                }
                else if(NodeType == XmlNodeType.Attribute) {
                    return encoder.AtributeInnerXml(Value);
                }
                else {
                    Read();
                }
            }
            return string.Empty;
        }