HOME
ABOUT ME
Biography
How I Became Boog
The Real Boog Powell
My Resume
WRITING
Stories
Reviews For Writers
Writing Links
CONTACT
   
   

Visit my other site:
Bleeker Books

Friends Of Boog


Recent Posts


Complete Archives

"Ah, but I was so much older then, I'm younger than that now."

My Boog Pages


Wednesday, October 12
Merry XMLmas

The last of the XML jokes, I swear. I managed to get around my problems from the post of last week and get at what I'm really trying to do: blast unedited HTML into the middle of an XML without any errors.

After a few false starts I settled on the method I've been using for months - make the HTML part of the XML itself, and display it using the proper codes in the template. I wasn't exactly hot for this solution, much less married to it, because you can have valid HTML that doesn't conform to the specifications for XML.

For example, take the <br> tag. Perfectly valid HTML. But XML requires all tags to be terminated, so in XML this should read <br/>. Same thing with <img> and lots of other tags. And if you make a typo? Crapville. As it happens there's not a handy way to enforce this, and if you mistype even one tag the XML programming interface pukes on you. Which is not just discouraging but smells bad, too.

One solution is to define the HTML as a CDATA section, so it's not evaluated as markup. The problem is that my templates don't display the ouput correctly. They display it as text instead of markup (it looks like <b>this<b/> instead of this).

Happily, I figured it out today. If the template tags that dump the CDATA are inside other tags, such as an 'if' command, they don't work, but if I put them in a separate template and invoke that - hey presto, it works.

I can see your attention wandering, so I'll shut up now. But let me just say, this is cool, because now I can open up some of the apps I've been working on without worrying about the users (aka 'lusers') mucking up the markup.


posted by Graham at 9:41 PM permalink

Trackbacks | Comments (4)


This page is powered by Blogger. Isn't yours?

Listed on BlogShares