3 Replies Latest reply on Jan 1, 2011 7:28 AM by Dirk Becker 

    Parsing simple HTML

    thomas.rollins

      Hi, I'm new to InDesign scripting and only wish I discovered it sooner! I absolutely love it! However, I'm working on a script which is somewhat 80% complete now, but have grinded to a halt. I need now to parse a simple html string, and format it in ID.

       

      I'm working with Javascript on CS5

       

      The input string would look something like:

      <p>Here is a sample <b>bold</b> format, <i>italic</i> string.</p>

       

      I'd need to support tags p,b,i,dl,dd,dt.

       

      I'm guessing converting the p tags to \r is not an issue, but I'm unsure how to apply a style to part of a paragraph. Also, would I need to create a style for each style tag that I want to support?

       

      I've been reading about XML support but I'm confused as to how I'd use it for this problem. Would I use it as it's not a complete HTML nor XML string.

       

      Any tips / code would be greatly appreciated, thanks!