public function _convertData(&$array, $indent = 0)
{
$string = '';
$IND = str_repeat($this->_SPACER, $indent);
if (is_array($array)) {
if ($this->_is_assoc($array)) {
# HASH REFERENCE
$string .= $this->_CRLF . $IND . '<dt_assoc>';
$end = '</dt_assoc>';
} else {
# ARRAY REFERENCE
$string .= $this->_CRLF . $IND . '<dt_array>';
$end = '</dt_array>';
}
foreach ($array as $k => $v) {
++$indent;
/* don't encode some types of stuff */
if (gettype($v) == 'resource' || gettype($v) == 'user function' || gettype($v) == 'unknown type') {
continue;
}
$string .= $this->_CRLF . $IND . '<item key="' . $k . '"';
if (gettype($v) == 'object' && get_class($v)) {
$string .= ' class="' . get_class($v) . '"';
}
$string .= '>';
if (is_array($v) || is_object($v)) {
$string .= $this->_convertData($v, $indent + 1);
$string .= $this->_CRLF . $IND . '</item>';
} else {
$string .= $this->_quoteXMLChars($v) . '</item>';
}
--$indent;
}
$string .= $this->_CRLF . $IND . $end;
} else {
# SCALAR
$string .= $this->_CRLF . $IND . '<dt_scalar>' . $this->_quoteXMLChars($array) . '</dt_scalar>';
}
return $string;
}