コード例 #1
0
 /**
  * Writes an XML string representing the rule info instance. 
  * 
  * @param XMLWriter $xmlWriter The XML writer. 
  * 
  * @return none
  */
 public function writeXml($xmlWriter)
 {
     $content = null;
     if (!is_null($this->_ruleDescription)) {
         $content = new Content();
         $content->setText(XmlSerializer::objectSerialize($this->_ruleDescription, 'RuleDescription'));
     }
     $this->_entry->setContent($content);
     $this->_entry->writeXml($xmlWriter);
 }
コード例 #2
0
 /**
  * Wraps media services entity with Atom entry
  *
  * @param object $entity Media services entity
  * @param array  $links  AtomLinks to other media services entities
  *
  * @return XML string representing Atom Entry
  */
 protected function wrapAtomEntry($entity, $links = null)
 {
     Validate::notNull($entity, 'entity');
     $content = new Content();
     $content->setType(Resources::XML_CONTENT_TYPE);
     $content->setText(ContentPropertiesSerializer::serialize($entity));
     $atomEntry = new Entry();
     $atomEntry->setContent($content);
     if ($links) {
         Validate::isArray($links, 'links');
         $atomEntry->setLink($links);
     }
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $atomEntry->writeXml($xmlWriter);
     return $xmlWriter->outputMemory();
 }
コード例 #3
0
 /**
  * @covers WindowsAzure\Common\Internal\Atom\Content::writeXml
  */
 public function testWriteXml()
 {
     // Setup
     $expected = '<atom:content type="testType" xmlns:atom="http://www.w3.org/2005/Atom">testText</atom:content>';
     $expectedContentType = 'testType';
     $expectedText = 'testText';
     $content = new Content();
     // Test
     $content->setType($expectedContentType);
     $content->setText($expectedText);
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $content->writeXml($xmlWriter);
     $actual = $xmlWriter->outputMemory();
     // Assert
     $this->assertEquals($expected, $actual);
 }
コード例 #4
0
 /**
  * Returns a XML string based on ATOM ENTRY schema. 
  * 
  * @param \XMLWriter $xmlWriter The XML writer.
  *
  * @return none
  */
 public function writeXml($xmlWriter)
 {
     $content = null;
     if (!is_null($this->_queueDescription)) {
         $content = new Content();
         $content->setText(XmlSerializer::objectSerialize($this->_queueDescription, 'QueueDescription'));
         $content->setType(Resources::XML_CONTENT_TYPE);
     }
     $this->_entry->setContent($content);
     $this->_entry->writeXml($xmlWriter);
 }
コード例 #5
0
 /**
  * @covers WindowsAzure\Common\Internal\Atom\Entry::getContent
  * @covers WindowsAzure\Common\Internal\Atom\Entry::setContent
  */
 public function testEntryGetSetContent()
 {
     // Setup
     $expected = new Content();
     $expected->setText('testText');
     $entry = new Entry();
     // Test
     $entry->setContent($expected);
     $actual = $entry->getContent();
     // Assert
     $this->assertEquals($expected->getText(), $actual->getText());
 }