Skip to content

Getting Started: 3. Adding XML Fragments

Daniele Orlando edited this page Feb 21, 2016 · 2 revisions

Sometimes XML/XHTML comes from legacy templating systems or external sources. In those cases the raw XML fragment can be injected directly into the document.

$book->add('cover', true)
        ->add(<<<XML
              <h1>The Theory Of Everything</h1>
              <img src="http://goo.gl/kO3Iov"/>
XML
);

Pro Tip:
The XML fragment doesn't need necessarily a root node, as in the example above.

4. XPath Queries 〉