XmlDocument
MMO\core\documents · 1 symbol · generated 5 Oct 2026
XmlDocument
XmlDocument.php:20A Document whose body is an XML tree (XmlNodes/XmlNode) instead of a plain array, rendered via XmlPrinter. Unless built Document::Raw(), the body starts with a <SERVER id="mmoconsole"> node (createBody) that logEvent appends recorded Log entries into, so logs show up inline in the rendered XML (as comments -- see XmlPrinter::exportLog) instead of only via
Index
| absoluteUrl($url) | Resolve $url against this document's own URL (getUrl), or against the application's own base URL if this document has none. | |
| createBody($charset, $opts) | Build the initial body: just the XML declaration when Document::isRaw, otherwise the declaration plus an empty <SERVER id="mmoconsole"> node (kept in $logs, see logEvent) that reco… | |
| createNode($tag, $attrs, $nodes) | Build a new XML node (XmlNodes::create), without adding it to the document: there is no one right place for it. | |
| getUrl() | ||
| setLogs($logs) | Replace the whole log collection. | |
| setUrl($url) | Set this document's canonical URL (as a 'current' link -- see LinkProviderInterface), used as the base for absoluteUrl. | |
| __construct($body, $opts) |
Methods7
absoluteUrl($url)
XmlDocument.php:86Resolve $url against this document's own URL (getUrl), or against the application's own base URL if this document has none.
createBody($charset, $opts)
XmlDocument.php:41Build the initial body: just the XML declaration when Document::isRaw, otherwise the declaration plus an empty <SERVER id="mmoconsole"> node (kept in $logs, see logEvent) that recorded logs are rendered into.
createNode($tag, $attrs, $nodes)
XmlDocument.php:102Build a new XML node (XmlNodes::create), without adding it to the document: there is no one right place for it. Add it yourself -- $doc[] = $node at the root of the body (a second root element next to the <SERVER> console node, unless the document is Document::Raw), $doc['body'][] = $node in an
- See
HtmlDocument's<body>.
| $tag = null | null | string | the tag name (null for a fragment: an XmlNodes of $nodes, with no tag). |
| $attrs = [] | array | |
| $nodes = [] | array | child nodes/content. |
| returns | XmlNodes | the new node, attached to nothing. |
getUrl()
XmlDocument.php:76setLogs($logs)
XmlDocument.php:56Replace the whole log collection. Unlike the parent (a plain array), here $logs is normally the <SERVER> XML node embedded in the body (see createBody) -- so this also updates the body tree: swaps in $logs itself if it's a detached (parent-less) XML node, otherwise just removes the old node.
setUrl($url)
XmlDocument.php:70Set this document's canonical URL (as a 'current' link -- see LinkProviderInterface), used as the base for absoluteUrl. Updates the existing 'current' link if there is one, otherwise adds one.
__construct($body, $opts)
XmlDocument.php:27| $body = null | null | XmlNodes | defaults to createBody's result. |
| $opts = [] | iOptions | array |
Inherited members (50)
| Properties | Declared by | Description | |
|---|---|---|---|
body | Document | ||
importPaths | Document | ||
links | Document | ||
logs | Document | ||
meta | Document | Free-form metadata about this document (e.g. | |
opts | Document | ||
readOnly | Document | If true, the document's body/links/meta can no longer be modified (setters throw eRuntime). |
| Methods | Declared by | Description | |
|---|---|---|---|
addContent($data) | Document | Recursively merge $data into the current body (see merge). | |
addImportPath($path, $first) | Document | Add one base directory to the import search paths. | |
addLink($link) | Document | Append a link to this document. | |
addMeta($data) | Document | Recursively merge $data into $meta (existing keys are overwritten, not combined -- see merge's $combine argument). | |
addOptions($opts, $appendList) | Document | Merge $opts into the existing options (through merge), rather than replacing them wholesale like setOptions. | |
addVars($vars) | Document | Merge extra variables into the set made available to import()-ed files. | |
clearLogs() | Document | Discard all recorded logs. | |
clearOptions() | Document | Empty the options bag. | |
createStream() | Document | ||
findImportPath($filename) | Document | Resolve a relative filename against getImportPaths (first match wins). | |
getBody() | Document | ||
getImportPaths() | Document | ||
getLinkByRel($rel) | Document | ||
getLinks() | Document | Returns an iterable of LinkInterface objects. | |
getLinksByRel($rel) | Document | Returns an iterable of LinkInterface objects that have a specific relationship. | |
getLogs() | Document | ||
getOption($key, $default) | Document | ||
getOptions() | Document | ||
getPrinter() | Document | ||
getVars() | Document | Get the variables available for import | |
hasLogs($flag) | Document | ||
import($_FILENAME, $_VARS, $_KEY) | Document | Import (require) a PHP/phtml file as a sub-template, capturing its output. | |
isImportValid($filename) | Document | ||
isRaw() | Document | ||
jsonSerialize() | Document | ||
logEvent($event) | Document | Record a log/event on this document, e.g. | |
offsetExists($offset) | Document | ArrayAccess: isset($document[$offset]) -- true for a body entry with a non-null value, or, when the body is a plain array, for any existing key (including one whose value is null). | |
offsetGet($offset) | Document | ArrayAccess: $document[$offset] -- returns null for a missing entry, same as `$document[$offset] ?? | |
offsetSet($offset, $value) | Document | ArrayAccess: $document[$offset] = $value sets a body entry ($document[] = $value appends). | |
offsetUnset($offset) | Document | ArrayAccess: unset($document[$offset]) removes a body entry. | |
Raw($body, $opts) | Document | Build a document whose isRaw is true from the start (see setRaw for what "raw" means). | |
removeLink($link) | Document | Remove a link (by identity). | |
render($opts) | Document | Export view to string | |
renderValue($value, $opts) | Document | Render an arbitrary value through this document's printer (getPrinter, or TextPrinter by default), merging $opts over the document's own options. | |
setBody($body) | Document | Replace the document's content, then dispatch DocumentInit. | |
setImportPaths($paths) | Document | Replace the base directories searched by findImportPath/import for a relative filename. | |
setOption($key, $value) | Document | Set (or, with a null $value, remove) a single option. | |
setOptions($opts) | Document | Replace the whole options bag. | |
setPrinter($printer) | Document | ||
setRaw($raw) | Document | Tells a document should be left as raw as possible. | |
setVars($vars) | Document | Replace the variables made available to import()-ed files (a 'document' => $this var is always added at construction, see __construct). | |
startCapture($key) | Document | Start output capture. | |
__toString() | Document |