Q:

Is PDF an XML format? 

I was intrigued by a question for a long time :
If PDF is XML
why can't I simply create a PDF document by simply adhering to XML rules
by setting elements, and attributes, proper nesting ... etc? 

A:

If PDF is XML why can't I simply...

PDF is not XML. 
To generate PDF from XML, use XSLT to convert the XML to XSL:FO, which can then be rendered to PDF by an XSL-FO processor such as Apache FOP, Antenna House, or RenderX.

