示例#1
0
 /**
  * Start the stream reader/writer as if it is a XML document.
  *
  * @param   \Hoa\Stream\IStream\In  $stream                 Stream to
  *                                                          read/write.
  * @param   bool                    $initializeNamespace    Whether we
  *                                                          initialize
  *                                                          namespaces.
  * @param   mixed                   $entityResolver         Entity resolver.
  * @param   bool                    $autoSave               Whether we
  *                                                          should
  *                                                          auto-save.
  * @return  void
  * @throws  \Hoa\Xml\Exception
  */
 public function __construct(Stream\IStream\In $stream, $initializeNamespace = true, $entityResolver = null, $autoSave = true)
 {
     if (true === $autoSave && !$stream instanceof Stream\IStream\Out) {
         throw new Exception('The stream %s (that has opened %s) must implement ' . '\\Hoa\\Stream\\IStream\\In and \\Hoa\\Stream\\IStream\\Out interfaces.', 0, [get_class($stream), $stream->getStreamName()]);
     }
     parent::__construct('\\Hoa\\Xml\\Element\\ReadWrite', $stream, $initializeNamespace, $entityResolver);
     if (true === $autoSave) {
         event('hoa://Event/Stream/' . $stream->getStreamName() . ':close-before')->attach(xcallable($this, '_close'));
     }
     $this->_autoSave = $autoSave;
     return;
 }
示例#2
0
文件: Read.php 项目: Grummfy/Central
 /**
  * Start the stream reader as if it is a XML document.
  *
  * @param   \Hoa\Stream\IStream\In  $stream                 Stream to read.
  * @param   bool                    $initializeNamespace    Whether we
  *                                                          initialize
  *                                                          namespaces.
  * @param   mixed                   $entityResolver         Entity resolver.
  * @return  void
  */
 public function __construct(Stream\IStream\In $stream, $initializeNamespace = true, $entityResolver = null)
 {
     parent::__construct('\\Hoa\\Xml\\Element\\Read', $stream, $initializeNamespace, $entityResolver);
     return;
 }
示例#3
0
文件: Write.php 项目: Grummfy/Central
 /**
  * Start the stream reader/writer as if it is a XML document.
  *
  * @param   \Hoa\Stream\IStream\Out  $stream                 Stream to
  *                                                           read/write.
  * @param   bool                     $initializeNamespace    Whether we
  *                                                           initialize
  *                                                           namespaces.
  * @param   mixed                    $entityResolver         Entity resolver.
  * @return  void
  */
 public function __construct(Stream\IStream\Out $stream, $initializeNamespace = true, $entityResolver = null)
 {
     parent::__construct('\\Hoa\\Xml\\Element\\Write', $stream, $initializeNamespace, $entityResolver);
     event('hoa://Event/Stream/' . $stream->getStreamName() . ':close-before')->attach(xcallable($this, '_close'));
     return;
 }