XML · Structured output
XML structured output examples.
Package-local, copy-ready examples organized like the classes and methods reference. Open one example at a time, search by method, and jump from the right-side index.
XML individual library
Structured output examples with copy-ready, production-minded PHP.
Every snippet uses mnb/mnb-phpexcel-xml or its declared Core dependency. Each copied snippet includes strict typing, a concise summary, implementation guidance, readable limits, and a safe fixture check.
- 1
- examples
- 2
- documented methods
toStructuredXml()saveStructuredXml()<?php
declare(strict_types=1);
/*
Summary:
Serialize workbook-aware row counts, warnings, and source metadata as XML.
Implementation note:
Structured XML keeps the same summary and warning model as other Core-backed readers.
*/
use Mnb\PHPExcel\Format\Xml;
$xml = Xml::read(__DIR__ . '/report.xml', [
'row_tag' => 'row',
])->withHeaderRow(1)->toStructuredXml(
readOptions: ['preserve_original_row_numbers' => true],
xmlOptions: ['pretty' => true]
);
header('Content-Type: application/xml; charset=UTF-8');
echo $xml;No matching example found.Try a method name, task, or result.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue