XAO SPECIFICATION HANDBOOK

Xao Framework Specification · Release 1.0.0-dev

Architecture & XML Aggregation

How Xao builds a unified XML conglomeration document from databases, Markdown, and domain objects before delegating presentation to XSLT 3.0.

Document Slug
architecture
Section
Core Concepts
Audience
Application architects and backend developers
Status
stable
Source File
content/architecture.md
XML Contract
/xml/architecture

Xao is built around a single unifying architectural thesis: every request constructs one well-formed XML conglomeration document by aggregating heterogeneous data sources into a single DOM tree, then transforms that tree into the final representation via XSLT 3.0.

  Relational DB (PDO / DbToXml) ──┐
  Static / File XML Fragments  ───┼──▶  DomDoc / AppDoc  ──▶  XsltDriverInterface (XSLT 3.0)  ──▶  HTML / XML / RSS / JSON
  External Feeds & HTTP APIs   ───┤    (Conglomeration)         • PhcNativeXsltDriver (default, built-in xee-xslt)
  Domain DomDoc Objects        ───┤                             • SaxonHttpDriver (HTTP / distributed)
  Markdown to XML (CommonMark) ───┘                             • ClientSideXslDriver (fallback)

Why XML Conglomeration Works

  1. One data boundary, many outputs: Because PHP produces a clean XML tree rather than concatenating HTML strings, the exact same DomDoc can render HTML5, Atom/RSS, SVG, print-ready specs, or raw XML without changing PHP controllers.

  2. True separation of concerns: PHP handles authentication, database queries, slug validation, Markdown parsing, and error normalization. XSLT 3.0 handles layout, grouping, navigation highlights, and accessibility landmarks.

  3. Inspectable page state: During development or via dedicated endpoints like /xml/{slug} in XaoDocs, the entire request model is inspectable as a single XML artifact.

  4. Stateless worker safety: AppDoc and DocsApp hold zero mutable per-request static state, allowing phc serve mode = "worker" to reuse booted PHP workers across thousands of requests with zero state leakage.

Core Building Blocks

ComponentResponsibility
Xao\XaoRootStructured, inspectable error tracking (addError, addException, hasErrors) without silent failures
Xao\DomDocStrict PHP 8 DOMDocument / DOMXPath wrapper for tree construction, XML/file consumption, namespace-aware nodes, and <error> generation
Xao\DomFactorySafe entrypoints (fromXml, fromFile, fromRoot) enforcing XXE/DOCTYPE rejection and realpath() containment
Xao\DbToXmlSerializes PDO queries, PDOStatement, and iterables into clean <result><row> XML trees
Xao\AppDocStateless front controller pairing routes, gated debug output (?xao:XML=1), and XSLT 3.0 drivers
Xao\Xslt\TransformerEnforces stylesheet-root realpath() containment and delegates rendering to XsltDriverInterface

Explicit Non-Goals

Xao intentionally avoids competing with full-stack ecosystems like Laravel or Symfony:

Complete Handbook Index