Actions

CodeExample

4d30874fd792a

From Joomla! Documentation

Revision as of 12:26, 14 January 2011 by Elkuku (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Get the whole XML document or a part of it.

demo.xml

<jdoc>
        <doku kategory="Info">Wiki</doku>
</jdoc>

Get the whole XML document or a part of it.

<?php
 
$xml = JFactory::getXML('demo.xml');
 
echo '<pre>';
echo htmlentities($xml->asFormattedXML());
echo '</pre>';

Output:

<jdoc>
        <doku kategory="Info">Wiki</doku>
</jdoc>

Die "komprimierte" Ausgabe, z.B. zur Verwendung in Streams:

$xml->asFormattedXML(true)

Output:

<jdoc><doku kategory="Info">Wiki</doku></jdoc>

Output only a part of the document:

$xml->doku->asFormattedXML()

Output:

<doku kategory="Info">Wiki</doku>


Elkuku 11:26, 14 January 2011 (CST) Edit comment