iTextSharp.tool.xml.pipeline.html.HtmlPipeline.Open C# (CSharp) Method

Open() public method

public Open ( IWorkerContext context, Tag t, ProcessObject po ) : IPipeline
context IWorkerContext
t Tag
po iTextSharp.tool.xml.ProcessObject
return IPipeline
        public override IPipeline Open(IWorkerContext context, Tag t, ProcessObject po)
        {
            HtmlPipelineContext hcc = (HtmlPipelineContext)GetLocalContext(context);
            try {
                ITagProcessor tp = hcc.ResolveProcessor(t.Name, t.NameSpace);
                if (tp.IsStackOwner()) {
                    hcc.AddFirst(new StackKeeper(t));
                }
                IList<IElement> content = tp.StartElement(context, t);
                if (content.Count > 0) {
                    if (tp.IsStackOwner()) {
                        StackKeeper peek;
                        try {
                            peek = hcc.Peek();
                            foreach (IElement elem in content) {
                                peek.Add(elem);
                            }
                        } catch (NoStackException e) {
                            throw new PipelineException(String.Format(LocaleMessages.STACK_404, t.ToString()), e);
                        }
                    } else {
                        foreach (IElement elem in content) {
                            hcc.CurrentContent().Add(elem);
                        }
                    }
                }
            } catch (NoTagProcessorException e) {
                if (!hcc.AcceptUnknown()) {
                    throw e;
                }
            }
            return GetNext();
        }