Changeset 428

Show
Ignore:
Timestamp:
03/27/07 20:56:05 (2 years ago)
Author:
schst
Message:

Added ability to check, whether an implementation provides a feature

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/xml/stubDomXMLStreamWriter.php

    r391 r428  
    88 */ 
    99 
    10 stubClassLoader::load('net.stubbles.xml.stubXMLStreamWriter'); 
     10stubClassLoader::load('net.stubbles.xml.stubXMLStreamWriter', 
     11                      'net.stubbles.xml.stubAbstractXMLStreamWriter'); 
    1112 
    1213/** 
     
    1617 * @subpackage xml 
    1718 */ 
    18 class stubDomXMLStreamWriter extends stubBaseObject implements stubXMLStreamWriter { 
    19  
     19class stubDomXMLStreamWriter extends stubAbstractXMLStreamWriter implements stubXMLStreamWriter { 
     20 
     21    /** 
     22     * List of supported features 
     23     * 
     24     * @var array 
     25     */ 
     26    protected $features = array(stubXMLStreamWriter::FEATURE_AS_DOM, 
     27                                stubXMLStreamWriter::FEATURE_IMPORT_WRITER); 
     28     
    2029    /** 
    2130     * DOM Document 
  • trunk/src/main/php/net/stubbles/xml/stubLibXmlXMLStreamWriter.php

    r192 r428  
    88 */ 
    99 
    10 stubClassLoader::load('net.stubbles.xml.stubXMLStreamWriter'); 
     10stubClassLoader::load('net.stubbles.xml.stubXMLStreamWriter', 
     11                      'net.stubbles.xml.stubAbstractXMLStreamWriter'); 
    1112 
    1213/** 
     
    1617 * @subpackage xml 
    1718 */ 
    18 class stubLibXmlXMLStreamWriter extends stubBaseObject implements stubXMLStreamWriter { 
     19class stubLibXmlXMLStreamWriter extends stubAbstractXMLStreamWriter implements stubXMLStreamWriter { 
    1920 
     21    /** 
     22     * List of supported features 
     23     * 
     24     * @var array 
     25     */ 
     26    protected $features = array(stubXMLStreamWriter::FEATURE_AS_DOM); 
     27     
    2028    /** 
    2129     * Writer 
     
    162170     */ 
    163171    public function importStreamWriter(stubXMLStreamWriter $writer) { 
    164         throw new stubXMLException('Operation not supported'); 
     172        throw new stubXMLException('Operation not supported.'); 
    165173    } 
    166174 
  • trunk/src/main/php/net/stubbles/xml/stubXMLStreamWriter.php

    r192 r428  
    1616interface stubXMLStreamWriter { 
    1717 
     18    /** 
     19     * Is able to import an stubXMLStreamWriter 
     20     * 
     21     * @var int 
     22     */ 
     23    const FEATURE_IMPORT_WRITER = 1; 
     24     
     25    /** 
     26     * Is able to export as DOM 
     27     * 
     28     * @var int 
     29     */ 
     30    const FEATURE_AS_DOM = 2; 
     31         
    1832    /** 
    1933     * Create a new writer 
     
    2438    #public function __construct($xmlVersion = '1.0', $encoding = 'ISO-8859-1'); 
    2539 
     40    /** 
     41     * Checks, whether the implementation has a desired feature 
     42     * 
     43     * @param int $feature 
     44     * @return bool 
     45     */ 
     46    public function hasFeature($feature); 
     47         
    2648    /** 
    2749     * Clear all data, that has been written