Author: kn
Date: Tue Feb  5 15:53:34 2008
New Revision: 7291

Log:
- Added class stubs for document handlers

Added:
    experimental/Document/src/document/
    experimental/Document/src/document/rst.php   (with props)
    experimental/Document/src/document/xml/
    experimental/Document/src/document/xml/docbook.php   (with props)
    experimental/Document/src/document/xml/ezp3.php   (with props)
    experimental/Document/src/document/xml/ezp4.php   (with props)
    experimental/Document/src/document/xml/xhtml.php   (with props)
    experimental/Document/src/document/xml_base.php   (with props)
Modified:
    experimental/Document/src/document_autoload.php
    experimental/Document/src/interfaces/converter.php

Added: experimental/Document/src/document/rst.php
==============================================================================
--- experimental/Document/src/document/rst.php (added)
+++ experimental/Document/src/document/rst.php [iso-8859-1] Tue Feb  5 15:53:34 
2008
@@ -1,0 +1,93 @@
+<?php
+/**
+ * File containing the ezcDocumentRst class
+ *
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * Document handler for RST text documents.
+ * 
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentRst extends ezcDocument
+{
+    /**
+     * XML document base options.
+     * 
+     * @var ezcDocumentXmlBaseOptions
+     */
+    protected $options;
+
+    /**
+     * Construct document xml base.
+     * 
+     * @ignore
+     * @return void
+     */
+    public function __construct()
+    {
+        $this->options = new ezcDocumentRstOptions();
+    }
+
+    /**
+     * Create document from input string
+     * 
+     * Create a document of the current type handler class and parse it into a
+     * usable internal structure.
+     *
+     * @param string $string 
+     * @return void
+     */
+    public function loadString( $string )
+    {
+        // @TODO: Implement
+    }
+
+    /**
+     * Return document compiled to the docbook format
+     * 
+     * The internal document structure is compiled to the docbook format and
+     * the resulting docbook document is returned.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     *
+     * @return ezcDocumentDocbook
+     */
+    public function getAsDocbook()
+    {
+        // @TODO: Implement
+    }
+
+    /**
+     * Create document from docbook document
+     *
+     * A document of the docbook format is provided and the internal document
+     * structure should be created out of this.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     * 
+     * @param ezcDocumentDocbook $document 
+     * @return void
+     */
+    public function createFromDocbook( ezcDocumentDocbook $document )
+    {
+        // @TODO: Implement
+    }
+}
+
+?>

Propchange: experimental/Document/src/document/rst.php
------------------------------------------------------------------------------
    svn:eol-style = native

Added: experimental/Document/src/document/xml/docbook.php
==============================================================================
--- experimental/Document/src/document/xml/docbook.php (added)
+++ experimental/Document/src/document/xml/docbook.php [iso-8859-1] Tue Feb  5 
15:53:34 2008
@@ -1,0 +1,72 @@
+<?php
+/**
+ * File containing the ezcDocumentDocbook class
+ *
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * The document handler for the docbook document markup.
+ * 
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentDocbook extends ezcDocumentXmlBase
+{
+    /**
+     * Construct document xml base.
+     * 
+     * @ignore
+     * @return void
+     */
+    public function __construct()
+    {
+        $this->options = new ezcDocumentDocbookOptions();
+    }
+
+    /**
+     * Return document compiled to the docbook format
+     * 
+     * The internal document structure is compiled to the docbook format and
+     * the resulting docbook document is returned.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     *
+     * @return ezcDocumentDocbook
+     */
+    public function getAsDocbook()
+    {
+        // @TODO: Implement
+    }
+
+    /**
+     * Create document from docbook document
+     *
+     * A document of the docbook format is provided and the internal document
+     * structure should be created out of this.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     * 
+     * @param ezcDocumentDocbook $document 
+     * @return void
+     */
+    public function createFromDocbook( ezcDocumentDocbook $document )
+    {
+        // @TODO: Implement
+    }
+}
+
+?>

Propchange: experimental/Document/src/document/xml/docbook.php
------------------------------------------------------------------------------
    svn:eol-style = native

Added: experimental/Document/src/document/xml/ezp3.php
==============================================================================
--- experimental/Document/src/document/xml/ezp3.php (added)
+++ experimental/Document/src/document/xml/ezp3.php [iso-8859-1] Tue Feb  5 
15:53:34 2008
@@ -1,0 +1,72 @@
+<?php
+/**
+ * File containing the ezcDocumentEzp3Xml class
+ *
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * The document handler for the eZ Publish 3 XML document markup.
+ * 
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentEzp3Xml extends ezcDocumentXmlBase
+{
+    /**
+     * Construct document xml base.
+     * 
+     * @ignore
+     * @return void
+     */
+    public function __construct()
+    {
+        $this->options = new ezcDocumentEzp3XmlOptions();
+    }
+
+    /**
+     * Return document compiled to the docbook format
+     * 
+     * The internal document structure is compiled to the docbook format and
+     * the resulting docbook document is returned.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     *
+     * @return ezcDocumentDocbook
+     */
+    public function getAsDocbook()
+    {
+        // @TODO: Implement
+    }
+
+    /**
+     * Create document from docbook document
+     *
+     * A document of the docbook format is provided and the internal document
+     * structure should be created out of this.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     * 
+     * @param ezcDocumentDocbook $document 
+     * @return void
+     */
+    public function createFromDocbook( ezcDocumentDocbook $document )
+    {
+        // @TODO: Implement
+    }
+}
+
+?>

Propchange: experimental/Document/src/document/xml/ezp3.php
------------------------------------------------------------------------------
    svn:eol-style = native

Added: experimental/Document/src/document/xml/ezp4.php
==============================================================================
--- experimental/Document/src/document/xml/ezp4.php (added)
+++ experimental/Document/src/document/xml/ezp4.php [iso-8859-1] Tue Feb  5 
15:53:34 2008
@@ -1,0 +1,72 @@
+<?php
+/**
+ * File containing the ezcDocumentEzp4Xml class
+ *
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * The document handler for the eZ Publish 4 XML document markup.
+ * 
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentEzp4Xml extends ezcDocumentXmlBase
+{
+    /**
+     * Construct document xml base.
+     * 
+     * @ignore
+     * @return void
+     */
+    public function __construct()
+    {
+        $this->options = new ezcDocumentEzp4XmlOptions();
+    }
+
+    /**
+     * Return document compiled to the docbook format
+     * 
+     * The internal document structure is compiled to the docbook format and
+     * the resulting docbook document is returned.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     *
+     * @return ezcDocumentDocbook
+     */
+    public function getAsDocbook()
+    {
+        // @TODO: Implement
+    }
+
+    /**
+     * Create document from docbook document
+     *
+     * A document of the docbook format is provided and the internal document
+     * structure should be created out of this.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     * 
+     * @param ezcDocumentDocbook $document 
+     * @return void
+     */
+    public function createFromDocbook( ezcDocumentDocbook $document )
+    {
+        // @TODO: Implement
+    }
+}
+
+?>

Propchange: experimental/Document/src/document/xml/ezp4.php
------------------------------------------------------------------------------
    svn:eol-style = native

Added: experimental/Document/src/document/xml/xhtml.php
==============================================================================
--- experimental/Document/src/document/xml/xhtml.php (added)
+++ experimental/Document/src/document/xml/xhtml.php [iso-8859-1] Tue Feb  5 
15:53:34 2008
@@ -1,0 +1,72 @@
+<?php
+/**
+ * File containing the ezcDocumentXhtml class
+ *
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * The document handler for XHTML document markup.
+ * 
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentXhtml extends ezcDocumentXmlBase
+{
+    /**
+     * Construct document xml base.
+     * 
+     * @ignore
+     * @return void
+     */
+    public function __construct()
+    {
+        $this->options = new ezcDocumentXhtmlOptions();
+    }
+
+    /**
+     * Return document compiled to the docbook format
+     * 
+     * The internal document structure is compiled to the docbook format and
+     * the resulting docbook document is returned.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     *
+     * @return ezcDocumentDocbook
+     */
+    public function getAsDocbook()
+    {
+        // @TODO: Implement
+    }
+
+    /**
+     * Create document from docbook document
+     *
+     * A document of the docbook format is provided and the internal document
+     * structure should be created out of this.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     * 
+     * @param ezcDocumentDocbook $document 
+     * @return void
+     */
+    public function createFromDocbook( ezcDocumentDocbook $document )
+    {
+        // @TODO: Implement
+    }
+}
+
+?>

Propchange: experimental/Document/src/document/xml/xhtml.php
------------------------------------------------------------------------------
    svn:eol-style = native

Added: experimental/Document/src/document/xml_base.php
==============================================================================
--- experimental/Document/src/document/xml_base.php (added)
+++ experimental/Document/src/document/xml_base.php [iso-8859-1] Tue Feb  5 
15:53:34 2008
@@ -1,0 +1,114 @@
+<?php
+/**
+ * File containing the ezcDocumentXmlBase class
+ *
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * A base class for XML based document type handlers.
+ * 
+ * @package Document
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+abstract class ezcDocumentXmlBase extends ezcDocument
+{
+    /**
+     * DOM tree as the internal representation for the loaded XML.
+     * 
+     * @var DOMDocument
+     */
+    protected $document;
+
+    /**
+     * XML document base options.
+     * 
+     * @var ezcDocumentXmlBaseOptions
+     */
+    protected $options;
+
+    /**
+     * Construct document xml base.
+     * 
+     * @ignore
+     * @return void
+     */
+    public function __construct()
+    {
+        $this->options = new ezcDocumentXmlBaseOptions();
+    }
+
+    /**
+     * Create document from input string
+     * 
+     * Create a document of the current type handler class and parse it into a
+     * usable internal structure.
+     *
+     * @param string $string 
+     * @return void
+     */
+    public function loadString( $string )
+    {
+        // Use internal error handling to handle XML errors manually.
+        $oldXmlErrorHandling = libxml_use_internal_errors( true );
+        libxml_clear_errors();
+
+        // Load XML document
+        $this->document = new DOMDocument();
+        $this->document->loadXml( $string );
+
+        $errors = ( $this->options->failOnError ?
+            libxml_get_errors() :
+            null );
+
+        libxml_clear_errors();
+        libxml_use_internal_errors( $oldXmlErrorHandling );
+
+        // If there are errors and the error handling is activated throw an
+        // exception with the occured errors.
+        if ( $errors )
+        {
+            throw new ezcDocumentErrnousXmlException( $errors );
+        }
+    }
+
+    /**
+     * Return document compiled to the docbook format
+     * 
+     * The internal document structure is compiled to the docbook format and
+     * the resulting docbook document is returned.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     *
+     * @return ezcDocumentDocbook
+     */
+    abstract public function getAsDocbook();
+
+    /**
+     * Create document from docbook document
+     *
+     * A document of the docbook format is provided and the internal document
+     * structure should be created out of this.
+     *
+     * This method is required for all formats to have one central format, so
+     * that each format can be compiled into each other format using docbook as
+     * an intermediate format.
+     *
+     * You may of course just call an existing converter for this conversion.
+     * 
+     * @param ezcDocumentDocbook $document 
+     * @return void
+     */
+    abstract public function createFromDocbook( ezcDocumentDocbook $document );
+}
+
+?>

Propchange: experimental/Document/src/document/xml_base.php
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: experimental/Document/src/document_autoload.php
==============================================================================
--- experimental/Document/src/document_autoload.php [iso-8859-1] (original)
+++ experimental/Document/src/document_autoload.php [iso-8859-1] Tue Feb  5 
15:53:34 2008
@@ -2,7 +2,7 @@
 /**
  * Autoloader definition for the Document component.
  *
- * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
  * @license http://ez.no/licenses/new_bsd New BSD License
  * @version //autogentag//
  * @filesource
@@ -12,13 +12,16 @@
 return array(
     'ezcDocument'               => 'Document/interfaces/document.php',
     'ezcDocumentConverter'      => 'Document/interfaces/converter.php',
-    'ezcDocumentBinary'         => 'Document/document_binary.php',
+    'ezcDocumentXmlBase'        => 'Document/document/xml_base.php',
+    'ezcDocumentDocbook'        => 'Document/document/xml/docbook.php',
     'ezcDocumentEzp3ToEzp4'     => 'Document/converters/ezp3_ezp4.php',
-    'ezcDocumentOutput'         => 'Document/output.php',
-    'ezcDocumentParser'         => 'Document/parser.php',
-    'ezcDocumentText'           => 'Document/document_text.php',
-    'ezcDocumentValidator'      => 'Document/validator.php',
-    'ezcDocumentXML'            => 'Document/document_xml.php',
+    'ezcDocumentEzp3Xml'        => 'Document/document/xml/ezp3.php',
+    'ezcDocumentEzp4Xml'        => 'Document/document/xml/ezp4.php',
+    'ezcDocumentHtmlConversion' => 'Document/interfaces/conversions/html.php',
+    'ezcDocumentManager'        => 'Document/document_manager.php',
+    'ezcDocumentRst'            => 'Document/document/rst.php',
+    'ezcDocumentValidation'     => 'Document/interfaces/vadation.php',
+    'ezcDocumentXhtml'          => 'Document/document/xml/xhtml.php',
     'ezcDocumentXhtmlToDocbook' => 'Document/converters/xhtml_docbook.php',
 );
 ?>

Modified: experimental/Document/src/interfaces/converter.php
==============================================================================
--- experimental/Document/src/interfaces/converter.php [iso-8859-1] (original)
+++ experimental/Document/src/interfaces/converter.php [iso-8859-1] Tue Feb  5 
15:53:34 2008
@@ -27,7 +27,7 @@
      * @param ezcDocument $doc 
      * @return ezcDocument
      */
-    abstract public function convert( ezcDocument $doc );
+    public function convert( ezcDocument $doc );
 }
 
 ?>


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to