If you wish to generate a text representation of a DOMIT_Document or DOMIT_Node -- and all nodes in the hierarchy below -- two methods are available:
toString prints out an unformatted string representation. No whitepace or newlines are added to enhance readability:
echo $cdCollection->toString();
returns:
<cdlibrary><cd id="0001">
<name>Robbie Fulks</name>
<title>Couples in Trouble</title></cd>
<cd id="0002"><name>Richard Thompson</name>
<title>Mock Tudor</title></cd><cd id="0003">
<name>Keller Williams</name>
<title>Laugh</title></cd></cdlibrary>
toNormalizedString prints out a formatted string representation, with whitepace and newlines added to enhance readability:
echo $cdCollection->toNormalizedString();
returns:
<cdlibrary>
<cd id="0001">
<name>Robbie Fulks</name>
<title>Couples in Trouble</title>
</cd>
<cd id="0002">
<name>Richard Thompson</name>
<title>Mock Tudor</title>
</cd>
<cd id="0003">
<name>Keller Williams</name>
<title>Laugh</title>
</cd>
</cdlibrary>
Note that toNormalizedString requires the file xml_domit_utilities.php to be present in the same directory as xml_domit_parser.php.
|