This is an example that lets you store your websites content in text files separate from your web pages. The web pages and the content are combined using XML. You will learn some basic XML.
Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Easy XML to Connect Content to Web Page

XML(Extensible Markup Language) is latest rage in programmer land, but it's actual implementation on the Web is proceeding at a snail's pace. That's because it's way more complicated than html, and nobody is explaining it in plain, simple English. Your typical book on XML starts out by explaining that XML is a "meta" language.

Nobody cares if it's a meta language or a "potato" language. What people want is a simple, clear "hands-on" explanation of how to use XML. Unfortunately learning XML is like learning mathematics. You can't learn it top-down. You have to learn it from the bottom-up.

The real power of XML comes when it's teamed up with SXL and/or SOAP. Your typical book on XML makes you dog through every detail of XML syntax, and sometimes XSL and SOAP too, before you get any practical hands-on experience.

XSL (Extensible Stylesheet Language) allows you to display the same XML data by applying different XSL style sheets to it. A server can detect the parameters of the device you are using to view the data, and apply the appropriate style sheet to make it look nice. SOAP (Simple Object Access Protocol) allows you communicate with Web services using messages written in text (XML text to be specific).

This is all very amazing, but programmers learn by writing some code and watching it work. You can't learn all the syntax of XML and XSL and SOAP all at once, and you don't have to. You can write some XML code and make it do something useful by combining it with a bit of html and JavaScript.

What I am going to present here is an example that lets you store your website's content in text files separate from your web pages. The web pages and the content are combined using XML. You will learn some basic XML, including how to write a DTD (Document Type Defintion) and how to use "external XML Entites".

This is going to be mind-blowingly simple. I stated that you can make XML do something useful by combinig it with a bit Java Script. If you don't know Java Script, you should learn. It's a fun and easy to use language. But you don't need to know any Java Script for this example. Below is the entire Java Script that will be used in this example.

function drawPage()
 rootElem  = pageContent.documentElement;
 var childnode;

 for(i = 0; i < rootElem.childNodes.length; i++)
  childnode = rootElem.childNodes.item(i);

Just paste this into a text file and save it with the file name drawpage.js. You will "include" this code in webpage(s) by placing the line shown below in the HEAD section of your webpage(s).

<script language="JavaScript" src="drawpage.js"></script>

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2024 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268