Hi Martin,
you are right! Better to search for the '>', not for "\n"
My imaginable solution may be like this way - put the attributes to an
array...
$this->__header = trim( str_replace( a( '<'.'?', '?'.'>' ), a('', ''),
substr(trim($this->__rawData), 0, strpos(trim($this->__rawData),
'?'.'>') )));
/**
* find the attributes and attributes2array
*/
preg_match_all("/\ (.*)\=\"(.*)\"/iU", $this->__header, $attrib_arr,
PREG_SET_ORDER);
$this->__header_attributes = array();
foreach ($attrib_arr as $found) {
if ( (isset($found[1])) AND (isset($found[2])) ) {
$this->__header_attributes[($found[1])] = $found[2];
}
}
...
debug( $this->__header_attributes );
...
result of "$this->__header" after your modified "str_replace":
xml version="1.0" encoding="UTF-8"
result: preg_match_all
Array
(
[0] => Array
(
[0] => version="1.0"
[1] => version
[2] => 1.0
)
[1] => Array
(
[0] => encoding="UTF-8"
[1] => encoding
[2] => UTF-8
)
)
result: $this->__header_attributes
Array
(
[version] => 1.0
[encoding] => UTF-8
)
RoVo (c:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---