Exemplo n.º 1
0
 private function buildRegisterXml(Resource $resource)
 {
     $resourceNode = new SimpleXMLElement('<resource type="' . $resource->getType() . '" />');
     foreach ($resource->getProperties() as $property) {
         $resourceNode->addChild('property', $property->getValue())->addAttribute('name', $property->getName());
     }
     foreach ($resource->getShares() as $share) {
         $shareNode = $resourceNode->addChild('share');
         $shareNode->addChild('name', $share->getName());
         $shareNode->addChild('identifier', $share->getIdentifier())->addAttribute('type', $share->getIdentifierType());
         $shareNode->addChild('permission', $share->getPermission());
     }
     //echo $clientNode->asXML();
     $dom = dom_import_simplexml($resourceNode)->ownerDocument;
     $dom->formatOutput = true;
     return $dom->saveXML();
 }