Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.php Subject: Re: Any recommendations on using PHP to parse marked-up text? Date: Sat, 27 Feb 2016 15:58:22 +1300 Lines: 19 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net nayKvCIIMGzNo3Adu2EOcwD4XtuzsI+nnvGJvsgxDVB7ZKEV6b Cancel-Lock: sha1:O3W8twbwAf/+LqasHffM1qW9fcI= User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: Xref: csiph.com comp.lang.php:16604 James Harris wrote: > Quick question: If someone wanted to parse marked-up text (and to > convert it to HTML) do you have any generic recommendation on a good > approach to use in PHP? > > Specifically, the text could be parsed character-by-character or line by > line. Or perhaps it could be split with explode() and processed in pieces. > > The input text could be ASCII or Unicode. > > The marking up would be by tags of some sort. The form of a tag is not > yet defined; it could be chosen to make the parsing easier, if > necessary, as long as it was easy for a human to work with. Write the text in Open/Libre Office and parse the XML with the native PHP parsers. -- Ian Collins