Ejemplo n.º 1
0
        /**
         * Called when an ending tag is encountered by the {@link SimpleXMLParser}.
         * This method searches for the tags {@link ITagProcessor} in the given
         * {@link TagProcessorFactory}. If none found and acceptUknown is false a
         * {@link NoTagProcessorException} is thrown. If found the TagProcessors
         * endElement is called.<br />
         * The returned IElement by the ITagProcessor is added to the currentContent
         * stack.<br />
         * If any of the parent tags or the given tags
         * {@link ITagProcessor#isStackOwner()} is true. The returned IElement is put
         * on the respective stack.Else it element is added to the document or the
         * elementList.
         *
         */
        public virtual void EndElement(String tag, String ns)
        {
            String thetag = null;

            if (parseHtml)
            {
                thetag = tag.ToLowerInvariant();
            }
            else
            {
                thetag = tag;
            }
            IWorkerContext ctx = GetLocalWC();

            if (null != ctx.GetCurrentTag() && !thetag.Equals(ctx.GetCurrentTag().Name))
            {
                throw new RuntimeWorkerException(String.Format(
                                                     LocaleMessages.GetInstance().GetMessage(LocaleMessages.INVALID_NESTED_TAG), thetag,
                                                     ctx.GetCurrentTag().Name));
            }
            IPipeline     wp = rootpPipe;
            ProcessObject po = new ProcessObject();

            try {
                while (null != (wp = wp.Close(ctx, ctx.GetCurrentTag(), po)))
                {
                    ;
                }
            } catch (PipelineException e) {
                throw new RuntimeWorkerException(e);
            } finally {
                if (null != ctx.GetCurrentTag())
                {
                    ctx.SetCurrentTag(ctx.GetCurrentTag().Parent);
                }
            }
        }