September 28, 2005

XML index


I want to create an XML index for my blog. The problem is that since the contents of the posts (and comments) are to appear as values of XML elements, they have to be entity-encoded. In particular "<" has to appear as "&lt;" and ">" has to appear as "&gt;". Is there a way that I can get MT to do that?

Right now I am using a kluge which you can see here, in which I use "$|" for "<" and "|$" for ">", then I make the four substitutions by hand (<, >, $|, |$, go to &lt;, &gt;, <, >, respectively, and in that order).

If I can't make MT do what I want, can I write a PHP script that will do this transformation for me on the server (so the url will give me what I want)?

If so, how do I do it?

If not, got any other ideas?

Posted by David Boxenhorn at September 28, 2005 02:18 PM | TrackBack
Comments
#1

looking at the templates used to produce RSS (a subset of XML) you can apply the remove_html and encode_xml attributes to the MT tags to do what you want.

<$MTEntryBody encode_xml="1"$>

Posted by Rob at September 28, 2005 05:05 PM
#2

Thanks a lot!! If you click on the link now, you'll see that it worked!

...now why didn't I think of that?

Posted by David Boxenhorn at September 28, 2005 09:06 PM
#3

My pleasure. Just out of curiosity why di you want an XML index?

Posted by Rob at September 29, 2005 12:58 PM
#4

I am working on a product that will do for applications what the World Wide Web did for documents. I need to whip up some sample applications to show it off a little (really showing it off would take more work than I can do by myself within a realistic timeframe). So I wrote a simple blog program, then I needed data.

Posted by David Boxenhorn at September 29, 2005 10:15 PM
Live Comment Preview
Post a comment









Remember personal info?