예제 #1
0
 /**
  * This method parses outer "object" nodes.
  *
  * @access protected
  * @param \SimpleXMLElement $root                           a reference to the root node
  * @param \SimpleXMLElement $node                           a reference to the "objects" node
  * @return Common\Mutable\ICollection                       a collection of objects
  */
 protected function parseOuterObjectElements(\SimpleXMLElement $root, \SimpleXMLElement $node)
 {
     $list = new Common\Mutable\ArrayList();
     $node->registerXPathNamespace('spring', Spring\Data\XML::NAMESPACE_URI);
     $children = $node->xpath('/spring:objects/spring:object');
     foreach ($children as $child) {
         $list->addValue($this->parseOuterObjectElement($root, $child));
     }
     switch ($list->count()) {
         case 0:
             return new Common\Mutable\HashMap();
         case 1:
             return $list->getValue(0);
         default:
             return $list;
     }
 }
예제 #2
0
 /**
  * This method parses the "soap:Envelope" node.
  *
  * @access protected
  * @param \SimpleXMLElement $root                           a reference to the "soap:Envelope" node
  * @return \Unicity\Common\Mutable\ICollection              a collection representing the data
  *                                                          in the soap file
  * @throws \Unicity\Throwable\Parse\Exception               indicates that an unrecognized child
  *                                                          node was encountered
  */
 protected function parseEnvelopeElement(\SimpleXMLElement $root)
 {
     $list = new Common\Mutable\ArrayList();
     $prefix = $this->metadata['namespace']['prefix'];
     $uri = $this->metadata['namespace']['uri'];
     $root->registerXPathNamespace($prefix, $uri);
     $children = $root->xpath("./{$prefix}:Body");
     foreach ($children as $child) {
         $list->addValue($this->parseBodyElement($child));
     }
     return $list->count() != 1 ? $list : $list->getValue(0);
 }