Пример #1
0
        /// <summary>
        /// </summary>
        /// <param name="buf"> </param>
        /// <param name="offset"> </param>
        /// <param name="ct"> </param>
        /// <param name="tok"> </param>
        private void EndTag(byte[] buf, int offset, ContentToken ct, TOK tok)
        {
            m_Depth--;
            m_ns.PopScope();

            if (current == null)
            {
                // end of doc
                if (OnStreamEnd != null)
                {
                    OnStreamEnd(this, m_root);
                }

                //              FireOnDocumentEnd();
                return;
            }

            //          if (current.Name != name)
            //              throw new Exception("Invalid end tag: " + name +
            //                  " != " + current.Name);
            var parent = (Element)current.Parent;

            if (parent == null)
            {
                DoRaiseOnStreamElement(current);

                // if (OnStreamElement!=null)
                // OnStreamElement(this, current);
                // FireOnElement(current);
            }

            current = parent;
        }
Пример #2
0
        private void EndTag(byte[] buf, int offset, ContentToken ct, TOK tok)
        {
            m_Depth--;
            m_ns.PopScope();

            if (current == null)
            {            // end of doc
                if (OnStreamEnd != null)
                {
                    OnStreamEnd(this, m_root);
                }
//				FireOnDocumentEnd();
                return;
            }

            string name = null;

            if ((tok == TOK.EMPTY_ELEMENT_WITH_ATTS) ||
                (tok == TOK.EMPTY_ELEMENT_NO_ATTS))
            {
                name = utf.GetString(buf,
                                     offset + m_enc.MinBytesPerChar,
                                     ct.NameEnd - offset -
                                     m_enc.MinBytesPerChar);
            }
            else
            {
                name = utf.GetString(buf,
                                     offset + m_enc.MinBytesPerChar * 2,
                                     ct.NameEnd - offset -
                                     m_enc.MinBytesPerChar * 2);
            }


//			if (current.Name != name)
//				throw new Exception("Invalid end tag: " + name +
//					" != " + current.Name);

            Element parent = (Element)current.Parent;

            if (parent == null)
            {
                DoRaiseOnStreamElement(current);
                //if (OnStreamElement!=null)
                //    OnStreamElement(this, current);
                //FireOnElement(current);
            }
            current = parent;
        }