View Single Post
  #4 (permalink)  
Old November 1st, 2006, 08:15 PM
woodyz woodyz is offline
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dparsons
 In either situation you need to write code to look for a pattern; if you go the route of XML then you need to write code to identifiy that a url exists and place it into your XML accordingly. (You also could probably do this in XSLT to look for a url and mark it accordingly)

And, even if you aren't using XML, you are still going to need to match a pattern in your code.
If you are using XML there is no need for pattern matching. That is the whole point and purpose of the xml. If you process the XML using code, you will work with the DOM and XPath to navigate to and operatate on the various elements - in the case of URLs you will then have your code wrap the URL in the anchor element (the a href tags). If you are using XSLT, you will simply use a call-template or a match template to process URL elements (that is, items that are marked with an element you use for this purpose).

Again - the reason I like XML for content markup is the same reason that the printing industry has used SGML for decades - formatting is separated from the content - you can format your output easily in any conceivable manner as long as you have a logical system for marking up the content. For example, if your content is stored as xml, you can easily output it as HTML, but you can just as easily output it as instructions to a Braille device, a human voice simulator, a typesetting application, or whatever.

Additionally, you can use XML content to generate menus, a table of contents, synopsis output, outlines, or whatever - all from the same content. As long as you put the content into the XML that you later wish to use, and mark-up the various uses of each discrete item of data - then you are in very good shape to be as creative as you want in devising the output.

Also, it is relatively easy to create XML from content that is stored in database tables and dynamically build XML from those parts of the content that are stored in an "un-marked-up" form.

Woody Z http://www.learntoprogramnow.com
Reply With Quote