Exemplo n.º 1
0
        private void Parse_ElementName()
        {
            while (this.ReadNext_char())
            {
                if (this.blankChars_hs.Contains(this.currChar))
                {
                    string eleName = HssStr.SafeXML_to_ori(this.sb.ToString());
                    this.element_st.Push(new Hss_XML_obj(eleName, this.ElementType));
                    this.sb.Clear();

                    this.ParsingState = XML_ParseState.InElement;
                    break;
                }
                else if (this.currChar == '>')
                {
                    string eleName = HssStr.SafeXML_to_ori(this.sb.ToString());
                    this.element_st.Push(new Hss_XML_obj(eleName, this.ElementType));
                    this.sb.Clear();
                    this.ParsingState = XML_ParseState.OutElement;
                    break;
                }
                else
                {
                    this.sb.Append(this.currChar);
                }
            }
        }
Exemplo n.º 2
0
        private void Parse_ElementStart()
        {
            if (!this.ReadNext_char())
            {
                return;
            }

            if (this.currChar == '?')
            {
                this.sb.Clear();
                this.ParsingState = XML_ParseState.ElementName;
                this.ElementType  = XML_ElementType.Declare;
            }
            else if (this.currChar == '!')
            {
                this.sb.Clear();
                this.ParsingState = XML_ParseState.CommentValue;
                this.ElementType  = XML_ElementType.Comment;
            }
            else if (this.currChar == '>')
            {
                Hss_XML_obj xo = this.element_st.Peek();
                xo.Add_obj(new Hss_XML_obj(null, this.ElementType));

                this.ParsingState = XML_ParseState.OutElement;
            }
            else if (this.currChar == '/')
            {
                Hss_XML_obj xo = this.element_st.Pop();
                xo.value = HssStr.SafeXML_to_ori(this.sb.ToString().Trim());
                this.sb.Clear();

                this.element_st.Peek().Add_obj(xo);
                //xo.Show();//test output

                this.ParsingState = XML_ParseState.ElementEnd;
            }
            else
            {
                this.sb.Clear();
                this.sb.Append(this.currChar);

                this.ParsingState = XML_ParseState.ElementName;
                this.ElementType  = XML_ElementType.Normal;
            }
        }