Using XML to format text
Posted: Sat Sep 29, 2007 9:39 am
Hi!
I'm making a homepage for a company right now and thay want it to be easy for them to change the content without having to contact me or my "associates" to get it done. So now I'm at somewhat of a crossroads and I kinda need a nudge in one direction or the other. My problem is this:
The textual content for any given page is stored in an XML file (at the moment). For example "home.xml" which is structured something like this:
Within the paragraphs I want to enable some sort of text formatting in the form tags, for instance a <bold></bold> tag for making the text bold.
The problem I'm having is that when I parse the XML-file I have no idea where the formatting tags are located within the paragraph tags, and I would like to keep the <> identifiers for tags _and_ not have to parse the document more than once. (I have a solution that would take two passes and use BB-codish syntax.)
Any ideas? Do I need to explain it better? ;)
I'm making a homepage for a company right now and thay want it to be easy for them to change the content without having to contact me or my "associates" to get it done. So now I'm at somewhat of a crossroads and I kinda need a nudge in one direction or the other. My problem is this:
The textual content for any given page is stored in an XML file (at the moment). For example "home.xml" which is structured something like this:
Code: Select all
<page>
<paragraph>Here be some text.</paragraph>
<paragraph>Here be more text.</paragraph>
</page>Code: Select all
<page>
<paragraph>Here be some text, <bold>and it's bold</bold>.</paragraph>
<paragraph>Here be more text.</paragraph>
</page>Any ideas? Do I need to explain it better? ;)