Beispiel #1
0
        /**
         * This method passes encountered text to the pipeline via the
         * {@link Pipeline#content(WorkerContext, Tag, byte[], ProcessObject)}
         * method.
         */
        virtual public void Text(String text)
        {
            if (text.StartsWith("<![CDATA[") && text.EndsWith("]]>"))
            {
                if (IgnoreCdata())
                {
                    return;
                }
                else
                {
                    text = text.Substring(9, text.Length - 12);
                }
            }
            IWorkerContext ctx = GetLocalWC();

            if (null != ctx.GetCurrentTag())
            {
                if (text.Length > 0)
                {
                    IPipeline     wp = rootpPipe;
                    ProcessObject po = new ProcessObject();
                    try {
                        while (null != (wp = wp.Content(ctx, ctx.GetCurrentTag(), text, po)))
                        {
                            ;
                        }
                    } catch (PipelineException e) {
                        throw new RuntimeWorkerException(e);
                    }
                }
            }
        }
Beispiel #2
0
        /**
         * This method passes encountered text to the pipeline via the
         * {@link Pipeline#content(WorkerContext, Tag, byte[], ProcessObject)}
         * method.
         */
        virtual public void Text(String text)
        {
            IWorkerContext ctx = GetLocalWC();

            if (null != ctx.GetCurrentTag())
            {
                if (text.Length > 0)
                {
                    IPipeline     wp = rootpPipe;
                    ProcessObject po = new ProcessObject();
                    try {
                        while (null != (wp = wp.Content(ctx, ctx.GetCurrentTag(), text, po)))
                        {
                            ;
                        }
                    } catch (PipelineException e) {
                        throw new RuntimeWorkerException(e);
                    }
                }
            }
        }
Beispiel #3
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);
                }
            }
        }