Some interesting things about XML...

From: Jim Carlock (anonymous_at_localhost.com)
Date: 03/17/05


Date: Thu, 17 Mar 2005 03:17:00 GMT

If you're familiar with HTML, you know HTML has tags which
are used to define how a page is laid out. What is a tag?

<p>The start and stop tags of this paragraph.</p>
<a href="linktopage.htm">Link to me.</a>

In the two examples above:
"<p>" and "</p>" represent the start and stop tags for the
paragraph element.
"<a>" and "</a>" represent the start and stop tags for the
whatever <a> means tag.

XML is pretty much the same thing, except *you* define the
tags and *you* use the tags to hold whatever content it's
designed to hold. However, in with HTML, the tags define
the layout and various other objects used. XML is much
simpler. *You* define what the tags in XML mean and you
define how those tags are used and what the contents of
those tags contain.

Folks typically think of XML and use XML as a database...

EXAMPLE 1
--------------
<contact>
<namefirst>Jim</namefirst>
<namelast>Carlock</lastname>
<addr1>123 Any Street</addr1>
/* ...etc */
</contact>

EXAMPLE 2
--------------
<menu>
<menutopic>File</menutopic>
<submenuitem>Exit</submenuitem>
<menutopic>Edit</menutopic>
<submenuitem>Copy Ctrl-C</submenuitem>
<submenuitem>Cut Ctrl-X</submenuitem>
<submenuitem>Paste Ctrl-V</submenuitem>
<menutopic>Help</menutopic>
<submenuitem>About</submenuitem>
</menu>

EXAMPLE 2 could be rewritten to separate the short-cut
key into a separate element.

EXAMPLE 3
--------------
<menu>
<menutopic>File</menutopic><sckey>Alt + F</sckey>
<submenuitem>Exit</submenuitem><sckey>Alt + X</sckey>
<menutopic>Edit</menutopic><sckey>Alt + E</sckey>
<submenuitem>Copy</submenuitem><sckey>Ctrl + C</sckey>
<submenuitem>Cut</submenuitem><sckey>Ctrl + X</sckey>
<submenuitem>Paste</submenuitem><sckey>Ctrl + V</sckey>
<menutopic>Help</menutopic><sckey>Alt + H</sckey>
<submenuitem>About</submenuitem><sckey>Ctrl + A</sckey>
</menu>

So what if there is no shortcut key in the example above?

<menutopic>File</menutopic><sckey />

You can also use <sckey></sckey> as an empty item. The
"/>" indicates that element is used with no closing tag.

Now there are some interesting things going on with OS's
and XML files.

Microsoft has set there current OS's up to read .manifest
files (these are XML files which are typically used to
define an XP look and feel - and who knows what). The
gdi.dll does some interesting things with .manifest files.
Microsoft has also programmed Internet Explorer to read the
contents of any file it opens and if it detects XML inside
of the doc it starts to process it as... I'm not sure what
it processes the file as but it's not what the extension of
the file says the file is... there seem to be some funny
things going on inside of the documents. .manifest files
are named for the app they apply to and are placed in the
same folder the app resides in, so if you had an app titled
newapp.exe, you could have a manifest named:

newapp.manifest.

It's possible that Win2K will read the .manifest files
before executing the app, but I haven't pursued that as of
yet. XP reads the contents of the manifest before running
any executable (I believe it's read before, rather than
during execution). In fact Microsoft uses .manifest files
to redefine the behaviours of various .dll files. Typically
you'll see talk about XP manifest where the manifest
redefines how an app is displayed on the screen and so I
believe this means that the .manifest causes an applications
calls to the gdi.dll to reroute to another routine inside
the app.

Microsoft is not only using .manifest files to display apps,
but to correct bugs in various dll's. There is a listview
control with a bug. Rather than fix the code inside the .dll
Microsoft gets around this by leaving the bug inside the .dll
and indicates a .manifest file fixes the problem. The only
other option that exists, is to use an older .dll. But with
Windows File Protection enabled and the System File Checker
working, Microsoft is making it hard to put anything other
than the current latest Microsoft .dll on the system.

Anyways, some of the more important things to realize about
an XML file, include:

1) They almost always have a tag at the top that defines the
language the file is written in...
<?xml version="1.0" encoding="UTF-32"?>

2) *You* define what the tags mean,
3) *You* define the contents of the tags,
4) *You* code how your app/applet uses the tags,
5) *You* provide the lang attribute inside of the <html> tag
if so desired...
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

And with that I close, and hope you find the information worthwhile.

--
Jim Carlock
Please post replies to newsgroup.


Relevant Pages

  • Re: word webpages
    ... The ther are som tags with no closing tags DreamWeaver would remove what ever was causing these problems. ... Just create a simple document and save as HTML Make sure it has some type of formatting. ... XML all versions ...
    (microsoft.public.mac.office.word)
  • Re: Getting NASM from C
    ... > format we were going to edit it in... ... all XML is? ... HTML is a specific "subset" of XML for displaying ... it's a text file with "tags" inside ...
    (alt.lang.asm)
  • Re: XML in XHTML
    ... > My problem is that javascript is understanding the nodes in my xml ... I take it you have embedded this as an 'xml data island' inside your HTML. ... contents as anything other than more HTML tags to parse. ...
    (comp.lang.javascript)
  • Re: [ANN] HTMLTemplate 1.0.0
    ... >>develops the XML elements for the layout. ... to implement) and EZT templates and ... ... > code-up your own tags and sprinkle them throughout your HTML. ...
    (comp.lang.python)
  • Re: parse inside of html tags
    ... > however a good generic test is: ... > this will find the contents of a set of tags like you have mentioned, ... markup such as HTML or XML. ... XML::DOM for XML. ...
    (comp.lang.perl)