Doing More With XML Schemas (part 4)
What's in a namespace? Quite a lot, it seems.
| The Name Game |
Setting up a namespace is simple - here's the syntax:
In this case, the prefix is the unique string used to identify the namespace; this is linked to a specific namespace URL.
A namespace is usually declared at the root element level, although authors are free to declare it at a lower level of the tree structure too.
Once the namespace has been declared within the document, it can be used by prefixing each element within that namespace with the unique namespace identifier. Take a look at my revised stock portfolio, which now uses a "mytrades" namespace to avoid name clashes.
And once Tom gets over his hangover, I guess he'd find it pretty easy to fix his document too.
<ts:item ts:name="Mouse C106">
<ts:item ts:name="Visor Deluxe">
In case you're wondering, the namespace URL is simply a pointer to a Web address, and is meaningless in practical terms; the XML specification doesn't really care where the URL points, or even if it's a valid link.
How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.
Read more, or grab your copy now!