iTextSharp.tool.xml.html.HTMLUtils.Sanitize C# (CSharp) Method

Sanitize() public static method

public static Sanitize ( String str ) : String
str String
return String
        public static String Sanitize(String str)
        {
            return Sanitize(str, false);
        }

Same methods

HTMLUtils::Sanitize ( String str, bool trim ) : String

Usage Example

Example #1
0
        /*
         * (non-Javadoc)
         *
         * @see
         * com.itextpdf.tool.xml.ITagProcessor#content(com.itextpdf.tool.xml.Tag,
         * java.util.List, com.itextpdf.text.Document, java.lang.String)
         */
        public override IList <IElement> Content(IWorkerContext ctx, Tag tag, String content)
        {
            List <Chunk>    sanitizedChunks = HTMLUtils.Sanitize(content, false);
            List <IElement> l = new List <IElement>(1);

            foreach (Chunk sanitized in sanitizedChunks)
            {
                HtmlPipelineContext myctx;
                try {
                    myctx = GetHtmlPipelineContext(ctx);
                } catch (NoCustomContextException e) {
                    throw new RuntimeWorkerException(e);
                }
                if (tag.CSS.ContainsKey(CSS.Property.TAB_INTERVAL))
                {
                    TabbedChunk tabbedChunk = new TabbedChunk(sanitized.Content);
                    if (null != GetLastChild(tag) && GetLastChild(tag).CSS.ContainsKey(CSS.Property.XFA_TAB_COUNT))
                    {
                        tabbedChunk.TabCount = int.Parse(GetLastChild(tag).CSS[CSS.Property.XFA_TAB_COUNT]);
                    }
                    l.Add(GetCssAppliers().Apply(tabbedChunk, tag, myctx));
                }
                else if (null != GetLastChild(tag) && GetLastChild(tag).CSS.ContainsKey(CSS.Property.XFA_TAB_COUNT))
                {
                    TabbedChunk tabbedChunk = new TabbedChunk(sanitized.Content);
                    tabbedChunk.TabCount = int.Parse(GetLastChild(tag).CSS[CSS.Property.XFA_TAB_COUNT]);
                    l.Add(GetCssAppliers().Apply(tabbedChunk, tag, myctx));
                }
                else
                {
                    l.Add(GetCssAppliers().Apply(sanitized, tag, myctx));
                }
            }
            return(l);
        }
All Usage Examples Of iTextSharp.tool.xml.html.HTMLUtils::Sanitize