Improved formatting of namespace details for arbitrary properties.

This commit is contained in:
Andrew McMillan 2007-11-15 16:35:29 +13:00
parent 1f5dad92f0
commit 60383ef3c2
2 changed files with 10 additions and 2 deletions

View File

@ -336,7 +336,15 @@ function collection_to_xml( $collection ) {
if ( count($collection->properties) > 0 ) {
foreach( $collection->properties AS $k => $v ) {
$prop->NewElement($k, $v );
if ( preg_match('/^(.*):([^:]+)$/', $k, $matches) ) {
$namespace = $matches[1];
$tag = $matches[2];
}
else {
$namespace = "";
$tag = $k;
}
$prop->NewElement(strtolower($tag), $v, array("xmlns" => strtolower($namespace)) );
}
}

View File

@ -5,7 +5,7 @@
<propstat>
<prop>
<displayname>User One's Calendar</displayname>
<URN:MCMILLAN:BOGUS:XML:NS:RSCDS:ARBITRARY>A completely bogus property which should be saved.</URN:MCMILLAN:BOGUS:XML:NS:RSCDS:ARBITRARY>
<arbitrary xmlns="urn:mcmillan:bogus:xml:ns:rscds">A completely bogus property which should be saved.</arbitrary>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>