XML Syntax

The primary thing you must understand before doing anything with XML is how XML documents themselves are structured. An XML document, which is just an organized text file, contains three parts:

  • The prolog or XML declaration

  • The document type declaration

  • The element(s)/content

The XML prolog (which is to say, prologue) is the first line of every XML file and should be in the form of

<?xml version="1.0"?> 

The next step, the document type declaration, is where you define your primary (or root) element.

<!DOCTYPE name 

...

>

This is similar to HTML documents that begin with <!DOCTYPE html, stating that the overarching element of the file is the html tag. Within the document type declaration, you can define your elements or you can reference ...

Get PHP Advanced for the World Wide Web: Visual QuickPro Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.