|
From: <nma...@us...> - 2006-03-30 08:24:56
|
Revision: 42 Author: nmarkgraf Date: 2006-03-30 00:24:22 -0800 (Thu, 30 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=42&view=rev Log Message: ----------- Refactoring session: - Removed OpenDocumentObjectAbstractTest, because namespaces now have a class names NameSpaces. Most of the unit test is now in NameSpacesTest.php. - Much fixes in other classes to match these changes. Remarks: - I think OpenDocumentObjectAbstract is obsolete and can be removed in future. Most of the stuff in it can be made in OpenDocumentAbstract. - All base classes should moved to util directory to clean up a little bit. Modified Paths: -------------- poc/build.xml poc/src/OpenDocumentObjectAbstract.php poc/src/OpenDocumentSingle.php poc/src/OpenDocumentSingleTest.php poc/src/content/Body.php poc/src/content/BodyTable.php poc/src/content/BodyText.php poc/src/content/Content.php poc/src/content/Scripts.php poc/src/manifest/Manifest.php poc/src/meta/Meta.php poc/src/samples/TestOutput.php poc/src/settings/Settings.php poc/src/styles/AutomaticStyles.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/MasterStyles.php poc/src/styles/Style.php poc/src/styles/Styles.php Added Paths: ----------- poc/src/util/ poc/src/util/NameSpaces.php poc/src/util/NameSpacesTest.php Removed Paths: ------------- poc/src/OpenDocumentObjectAbstractTest.php Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-29 13:59:14 UTC (rev 41) +++ poc/build.xml 2006-03-30 08:24:22 UTC (rev 42) @@ -81,12 +81,12 @@ <target name="dist" depends="production" description="Creates a snapshot of the current production release in a zip and a tar file in the dist directory."> <zip destfile="dist/OpenDocumentPHP-${release}.zip" basedir="production"/> - <tar destfile="dist/OpenDocumentPHP-${release}.tar" basedir="production"/> + <tar destfile="dist/OpenDocumentPHP-${release}.tar.gz" basedir="production" compression="gzip"/> </target> <target name="dist-src" depends="preparedist" description="Creates a snapshot of the current src directory in a zip and a tar file in the dist directory."> <zip destfile="dist/OpenDocumentPHP-${release}-src.zip" basedir="src"/> - <tar destfile="dist/OpenDocumentPHP-${release}-src.tar" basedir="src"/> + <tar destfile="dist/OpenDocumentPHP-${release}-src.tar.gz" basedir="src" compression="gzip"/> </target> <target name="dev-dist" depends="preparedist" description="Creates a snapshot of the all the current project directories in a zip and a tar file in the dist directory."> @@ -94,16 +94,27 @@ <fileset dir="."> <include name="**/**"/> <exclude name="**/?svn/**"/> + <exclude name="**/dist/**"/> + <exclude name="**/reports/**"/> + <exclude name="**/docs/**"/> + <exclude name="**/production/**"/> </fileset> </zip> - <tar destfile="dist/OpenDocumentPHP-${release}-dev.tar" basedir="."> + <tar destfile="dist/OpenDocumentPHP-${release}-dev.tar.gz" basedir="." compression="gzip"> <fileset dir="."> <include name="**/**"/> <exclude name="**/?svn/**"/> + <exclude name="**/dist/**"/> + <exclude name="**/reports/**"/> + <exclude name="**/docs/**"/> + <exclude name="**/production/**"/> </fileset> - </tar> + </tar> </target> + <target name="dist-all" depends="dist,dist-src,dev-dist,solid-production" description="Creates a all snapshots in the dist directory."> + </target> + <target name="production" depends="prepare" description="Creates a production release without unit tests in the production directory."> <copy todir="production"> <fileset dir="src"> Modified: poc/src/OpenDocumentObjectAbstract.php =================================================================== --- poc/src/OpenDocumentObjectAbstract.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/OpenDocumentObjectAbstract.php 2006-03-30 08:24:22 UTC (rev 42) @@ -15,118 +15,8 @@ require_once( "OpenDocumentAbstract.php" ); class OpenDocumentObjectAbstract extends OpenDocumentAbstract { - - /** - * namespace OpenDocument meta - */ - const NS_META = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; - - /** - * namespace OpenDocument office - */ - const NS_OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0"; - - /** - * namespace OpenDocument manifest - */ - const NS_MANIFEST = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"; /** - * namespace OpenDocument style - */ - const NS_STYLE = "urn:oasis:names:tc:opendocument:xmlns:style:1.0"; - - /** - * namespace OpenDocument text - */ - const NS_TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0"; - - /** - * namespace OpenDocument draw - */ - const NS_DRAW = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; - - /** - * namespace OpenDocument table - */ - const NS_TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0"; - - /** - * namespace OpenDocument number - */ - const NS_NUMBER = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; - - /** - * namespace OpenDocument chart - */ - const NS_CHART = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; - - /** - * namespace OpenDocument form - */ - const NS_FORM = "urn:oasis:names:tc:opendocument:xmlns:form:1.0"; - - /** - * namespace OpenDocument config - */ - const NS_CONFIG = "urn:oasis:names:tc:opendocument:xmlns:config:1.0"; - - /** - * namespace OpenDocument presentation - */ - const NS_PRESENTATION = "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"; - - /** - * namespace OpenDocument dr3d - */ - const NS_DR3D = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; - - /** - * namespace OpenDocument animation - */ - const NS_ANIM = "urn:oasis:names:tc:opendocument:xmlns:animation:1.0"; - - /** - * namespace OpenDocument script - */ - const NS_SCRIPT = "urn:oasis:names:tc:opendocument:xmlns:script:1.0"; - - /** - * namespace OpenDocument svg - */ - const NS_SVG = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; - - /** - * namespace OpenDocument fo (formation objects) - */ - const NS_FO = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; - - /** - * namespace OpenDocument smil - */ - const NS_SMIL = "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"; - - /** - * namespace Dublin Core - */ - const NS_DC = "http://purl.org/dc/elements/1.1/"; - - /** - * namespace XLink - */ - const NS_XLINK = "http://www.w3.org/1999/xlink"; - - /** - * namespace XForms - */ - const NS_XFORMS = "http://www.w3.org/2002/xforms"; - - /** - * namespace MathML - */ - const NS_MATHML = "http://www.w3.org/1998/Math/MathML"; - - /** * @access protected */ protected $dom; Deleted: poc/src/OpenDocumentObjectAbstractTest.php =================================================================== --- poc/src/OpenDocumentObjectAbstractTest.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/OpenDocumentObjectAbstractTest.php 2006-03-30 08:24:22 UTC (rev 42) @@ -1,74 +0,0 @@ -<?php -/** - * TestCase for OpenDocumentObjectAbstract class - * - * $Id$ - * - * @copyright Copyright © 2006, Norman Markgraf, et al. - * @license GNU General Public License - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument - * @subpackage UnitTest - * @since 0.5.0 - */ - -require_once "PHPUnit2/Framework/TestCase.php"; -require_once "OpenDocumentObjectAbstract.php"; - -class OpenDocumentObjectAbstractTest extends PHPUnit2_Framework_TestCase { - -const office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"; -const style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"; -const text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"; -const table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"; -const draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; -const fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; -const xlink="http://www.w3.org/1999/xlink"; -const dc="http://purl.org/dc/elements/1.1/"; -const meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; -const number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; -const svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; -const chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; -const dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; -const math="http://www.w3.org/1998/Math/MathML"; -const form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"; -const script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"; -const ooo="http://openoffice.org/2004/office"; -const ooow="http://openoffice.org/2004/writer"; -const oooc="http://openoffice.org/2004/calc"; -const dom="http://www.w3.org/2001/xml-events"; - - /** - * This test will check all name spaces. The namespaces in this file are extracted from - * an OpenOffice document, so they are not written by hand out of the OpenDocument documentation. - * This should help to fix typos. (And it did!!!) - * - * @since 0.5.0 - */ - function testNamespaces() { - $this->assertEquals( OpenDocumentObjectAbstract::NS_OFFICE, self::office ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_STYLE, self::style ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_TEXT, self::text ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_TABLE, self::table ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_DRAW, self::draw ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_FO, self::fo ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_XLINK, self::xlink ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_DC, self::dc ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_META, self::meta ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_NUMBER, self::number ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_SVG, self::svg ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_CHART, self::chart ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_DR3D, self::dr3d ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_MATHML, self::math ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_FORM, self::form ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_SCRIPT, self::script ); -/* - $this->assertEquals( OpenDocumentObjectAbstract::NS_OOO, self::ooo ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_OOOW, self::ooow ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_OOOC, self::oooc ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_DOM, self::dom ); -*/ - } -} -?> \ No newline at end of file Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/OpenDocumentSingle.php 2006-03-30 08:24:22 UTC (rev 42) @@ -25,6 +25,7 @@ require_once( "styles/MasterStyles.php" ); require_once( "content/Body.php" ); require_once( "OpenDocumentAbstract.php" ); +require_once( "util/NameSpaces.php" ); class OpenDocumentSingle extends OpenDocumentAbstract implements OpenDocument { /** @@ -49,12 +50,6 @@ private $root; /** - * namespace OpenDocument office - * @since 0.3.0 - */ - const NS_OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0"; - - /** * * @access public * @@ -68,8 +63,8 @@ $this->isCommited = false; $this->dom = new DOMDocument( "1.0", "utf-8" ); - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document" ); - $this->root->setAttributeNS( self::NS_OFFICE, "office:mimetype", $mimetype ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document" ); + $this->root->setAttributeNS( NS::OFFICE, "office:mimetype", $mimetype ); $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclaration( $this->dom, $this->root ); Modified: poc/src/OpenDocumentSingleTest.php =================================================================== --- poc/src/OpenDocumentSingleTest.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/OpenDocumentSingleTest.php 2006-03-30 08:24:22 UTC (rev 42) @@ -38,12 +38,30 @@ $meta->addInitialCreator( "Testo Tester" ); $meta->addCreationDate(); - /* Initialize Font Face Declarations: */ + /* Initialize Font Face Declarations: */ + $fontfacedecl = $ODT->getFontFaceDeclaration(); + $styleAttr = array(); - $styleAttr[ "font-family" ] ="Tahoma"; - - $fontfacedelc = $ODT->getFontFaceDeclaration(); - $fontfacedelc->addFontFace( "Test", $styleAttr ); + $svgAttr = array(); + + $styleAttr[ "font-pitch" ] = "variable"; + $svgAttr [ "font-family" ] = "'Arial Unicode MS'"; + $fontfacedecl->addFontFace( "Arial Unicode MS", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "Tahoma"; + $fontfacedecl->addFontFace( "Tahoma", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "'MS Mincho'"; + $fontfacedecl->addFontFace( "MS Mincho", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "'Times New Roman'"; + $styleAttr[ "font-family-generic" ] = "roman"; + $fontfacedecl->addFontFace( "Times New Roman", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "Arial"; + $styleAttr[ "font-family-generic" ] = "swiss"; + $fontfacedecl->addFontFace( "Arial", $styleAttr, $svgAttr ); + unset( $styleAttr ); /* Add text to Body: */ Modified: poc/src/content/Body.php =================================================================== --- poc/src/content/Body.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/Body.php 2006-03-30 08:24:22 UTC (rev 42) @@ -15,6 +15,7 @@ require_once( "OpenDocumentObjectAbstract.php" ); require_once( "content/BodyText.php" ); require_once( "content/BodyTable.php" ); +require_once( "util/NameSpaces.php" ); class Body extends OpenDocumentObjectAbstract { @@ -51,7 +52,7 @@ $this->dom = $dom; $this->BodyFragment = $this->dom->createDocumentFragment(); - $this->body = $this->dom->createElementNS( self::NS_OFFICE, "office:body" ); + $this->body = $this->dom->createElementNS( NS::OFFICE, "office:body" ); $this->Fragments = array(); } @@ -94,7 +95,7 @@ */ public function getText() { $this->logger->debug( "content/Body->getText()" ); - return $this->getByNamespace( self::NS_TEXT, "BodyText" ); + return $this->getByNamespace( NS::TEXT, "BodyText" ); } /** @@ -104,7 +105,7 @@ */ public function getTable() { $this->logger->debug( "content/Body->getTable()" ); - return $this->getByNamespace( self::NS_TABLE, "BodyTable" ); + return $this->getByNamespace( NS::TABLE, "BodyTable" ); } /** Modified: poc/src/content/BodyTable.php =================================================================== --- poc/src/content/BodyTable.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/BodyTable.php 2006-03-30 08:24:22 UTC (rev 42) @@ -14,6 +14,7 @@ */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class BodyTable extends OpenDocumentObjectAbstract { /** @@ -27,7 +28,7 @@ $this->dom = $dom; $this->DomFragment = $dom->createDocumentFragment(); - $this->body = $this->DomFragment->createElementNS( self::NS_OFFICE, "office:table" ); + $this->body = $this->DomFragment->createElementNS( NS::OFFICE, "office:table" ); } /** Modified: poc/src/content/BodyText.php =================================================================== --- poc/src/content/BodyText.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/BodyText.php 2006-03-30 08:24:22 UTC (rev 42) @@ -13,6 +13,7 @@ */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class BodyText extends OpenDocumentObjectAbstract { /** @@ -27,7 +28,7 @@ $this->logger->debug( "Constructing OpenDocumentContentBodyText." ); $this->dom = $dom; - $this->text = $this->dom->createElementNS( self::NS_OFFICE, "office:text" ); + $this->text = $this->dom->createElementNS( NS::OFFICE, "office:text" ); } /** @@ -50,11 +51,11 @@ public function getTextParagraph( $styleName, $parText=0 ) { $this->logger->debug( "OpenDocumentContentBodyText->getTextParagraph(\"".$styleName."\",\"".$parText."\")" ); if (empty($parText)) { - $par = $this->dom->createElementNS( self::NS_TEXT, "text:p" ); + $par = $this->dom->createElementNS( NS::TEXT, "text:p" ); } else { - $par = $this->dom->createElementNS( self::NS_TEXT, "text:p", $parText ); + $par = $this->dom->createElementNS( NS::TEXT, "text:p", $parText ); } - $par->setAttributeNS( self::NS_TEXT, "text:style-name", $styleName ); + $par->setAttributeNS( NS::TEXT, "text:style-name", $styleName ); return $par; } @@ -78,12 +79,12 @@ public function getTextHeading( $styleName, $outlineLevel=1, $headText=0 ) { $this->logger->debug( "OpenDocumentContentBodyText->getTextHeading()" ); if (empty($headText)) { - $head = $this->dom->createElementNS( self::NS_TEXT, "text:h" ); + $head = $this->dom->createElementNS( NS::TEXT, "text:h" ); } else { - $head = $this->dom->createElementNS( self::NS_TEXT, "text:h", $headText ); + $head = $this->dom->createElementNS( NS::TEXT, "text:h", $headText ); } - $head->setAttributeNS( self::NS_TEXT, "text:style-name", $styleName ); - $head->setAttributeNS( self::NS_TEXT, "text:outline-level", $outlineLevel ); + $head->setAttributeNS( NS::TEXT, "text:style-name", $styleName ); + $head->setAttributeNS( NS::TEXT, "text:outline-level", $outlineLevel ); return $head; } @@ -95,10 +96,10 @@ */ public function addNoForms() { $this->logger->debug( "OpenDocumentContentBodyText->addNoForms()" ); - $forms = $this->dom->createElementNS( self::NS_OFFICE, "office:forms" ); + $forms = $this->dom->createElementNS( NS::OFFICE, "office:forms" ); - $forms->setAttributeNS( self::NS_FORM, "form:automatic-focus", "false" ); - $forms->setAttributeNS( self::NS_FORM, "form:apply-design-mode", "false" ); + $forms->setAttributeNS( NS::FORM, "form:automatic-focus", "false" ); + $forms->setAttributeNS( NS::FORM, "form:apply-design-mode", "false" ); $this->text->appendChild( $forms ); unset( $forms ); Modified: poc/src/content/Content.php =================================================================== --- poc/src/content/Content.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/Content.php 2006-03-30 08:24:22 UTC (rev 42) @@ -18,6 +18,7 @@ require_once( "styles/AutomaticStyles.php" ); require_once( "content/Body.php" ); require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class Content extends OpenDocumentObjectAbstract { @@ -42,8 +43,8 @@ $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document-content" ); - $this->root->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document-content" ); + $this->root->setAttributeNS( NS::OFFICE, "office:version", "1.0" ); $this->content = $this->dom; $this->Scripts = new Scripts( $this->dom, $this->root ); Modified: poc/src/content/Scripts.php =================================================================== --- poc/src/content/Scripts.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/Scripts.php 2006-03-30 08:24:22 UTC (rev 42) @@ -16,6 +16,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class Scripts extends OpenDocumentObjectAbstract { /** @@ -45,7 +46,7 @@ $this->logger->debug( "Constructing content/Scripts." ); $this->dom = $dom; - $this->scripts = $this->dom->createElementNS( self::NS_OFFICE, "office:scripts" ); + $this->scripts = $this->dom->createElementNS( NS::OFFICE, "office:scripts" ); $this->root = 0; } Modified: poc/src/manifest/Manifest.php =================================================================== --- poc/src/manifest/Manifest.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/manifest/Manifest.php 2006-03-30 08:24:22 UTC (rev 42) @@ -13,7 +13,8 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); - +require_once( "util/NameSpaces.php" ); + class Manifest extends OpenDocumentObjectAbstract { const odmPUBLIC = "-//OpenOffice.org//DTD Manifest 1.0//EN"; const odmSYSTEM = "Manifest.dtd"; @@ -61,11 +62,11 @@ $this->dom->encoding = "UTF-8"; $this->dom->formatOutput = true; - $this->root = $this->dom->createElementNS( self::NS_MANIFEST, self::odmROOT ); + $this->root = $this->dom->createElementNS( NS::MANIFEST, self::odmROOT ); - $node = $this->dom->createElementNS( self::NS_MANIFEST, "manifest:file-entry" ); - $node->setAttributeNS( self::NS_MANIFEST, "manifest:media-type", $this->mimetype ); - $node->setAttributeNS( self::NS_MANIFEST, "manifest:full-path", "/" ); + $node = $this->dom->createElementNS( NS::MANIFEST, "manifest:file-entry" ); + $node->setAttributeNS( NS::MANIFEST, "manifest:media-type", $this->mimetype ); + $node->setAttributeNS( NS::MANIFEST, "manifest:full-path", "/" ); $this->root->appendChild( $node ); @@ -82,11 +83,11 @@ * @since 0.4.0 */ final public function addEntryToManifest( $fullpath, $mimetype, $size=-1, $encrypt=0 ) { - $node = $this->dom->createElementNS( self::NS_MANIFEST, "manifest:file-entry" ); - $node->setAttributeNS( self::NS_MANIFEST, "manifest:media-type", $mimetype ); - $node->setAttributeNS( self::NS_MANIFEST, "manifest:full-path", $fullpath ); + $node = $this->dom->createElementNS( NS::MANIFEST, "manifest:file-entry" ); + $node->setAttributeNS( NS::MANIFEST, "manifest:media-type", $mimetype ); + $node->setAttributeNS( NS::MANIFEST, "manifest:full-path", $fullpath ); if ( $size >= 0 ) { - $node->setAttributeNS( self::NS_MANIFEST, "manifest:size", $size ); + $node->setAttributeNS( NS::MANIFEST, "manifest:size", $size ); } if (!empty($encrypt)) { $node->appendChild( $encrypt ); @@ -103,7 +104,7 @@ * @since 0.4.0 */ final public function createEncryptionData( ) { - return $this->dom->createElmentNS( self::NS_MANIFEST, "manifest:encryption-data" ); + return $this->dom->createElmentNS( NS::MANIFEST, "manifest:encryption-data" ); } /** Modified: poc/src/meta/Meta.php =================================================================== --- poc/src/meta/Meta.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/meta/Meta.php 2006-03-30 08:24:22 UTC (rev 42) @@ -16,6 +16,10 @@ * @since 0.4.4 */ +require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); + + class Meta extends OpenDocumentObjectAbstract { /** @@ -50,8 +54,8 @@ $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; - $node = $this->dom->createElementNS( self::NS_OFFICE, "office:document-meta" ); - $node->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); + $node = $this->dom->createElementNS( NS::OFFICE, "office:document-meta" ); + $node->setAttributeNS( NS::OFFICE, "office:version", "1.0" ); $this->dom->appendChild( $node ); $this->meta = $node; @@ -60,7 +64,7 @@ $this->dom = $dom; $this->meta = $root; } - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:meta" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:meta" ); } /** @@ -95,19 +99,19 @@ return false; } - $OFFICE_PREFIX = $tmpDom->getElementsByTagNameNS( self::NS_OFFICE, "*").item( 0 )->prefix; + $OFFICE_PREFIX = $tmpDom->getElementsByTagNameNS( NS::OFFICE, "*").item( 0 )->prefix; // Figgure out if file is part of a package or a single document; - $isSingleDoc = (count($tmpDom->getElementsByTagNameNS( self::NS_OFFICE, $OFFICE_PREFIX.":document-meta" ))==0); + $isSingleDoc = (count($tmpDom->getElementsByTagNameNS( NS::OFFICE, $OFFICE_PREFIX.":document-meta" ))==0); if ($isSingleDoc) { $this->dom = $tmpDoc; $this->meta = $tmpDoc; } else { $this->dom = $tmpDoc; - $this->meta = $tmtDoc->getElementsByTageNameNS( self::NS_OFFICE, $OFFICE_PREFIX.":document-meta").item( 0 ); + $this->meta = $tmtDoc->getElementsByTageNameNS( NS::OFFICE, $OFFICE_PREFIX.":document-meta").item( 0 ); } - $this->root = $this->dom->getElementsByTageNameNS( self::NS_OFFICE, $OFFICE_PREFIX.":meta").item( 0 ); + $this->root = $this->dom->getElementsByTageNameNS( NS::OFFICE, $OFFICE_PREFIX.":meta").item( 0 ); return true; } @@ -123,7 +127,7 @@ */ public function addDublinCore( $dc, $value) { $this->logger->debug( "meta/Meta->addDublinCore: ". $value ."." ); - $node = $this->dom->createElementNS( self::NS_DC, "dc:".$dc, $value ); + $node = $this->dom->createElementNS( NS::DC, "dc:".$dc, $value ); $this->root->appendChild( $node ); unset( $node ); } @@ -140,7 +144,7 @@ */ public function getDublicCore( $dc ) { $retValue = ""; - $nodelist = $this->dom->getElementsByTagNameNS( self::NS_DC, $dc ); + $nodelist = $this->dom->getElementsByTagNameNS( NS::DC, $dc ); if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } @@ -176,7 +180,7 @@ } $this->logger->debug( "meta/Meta->addCreationTime: ". $creation_time ."." ); - $node = $this->dom->createElementNS( self::NS_META, "meta:creation-date", $creation_time ); + $node = $this->dom->createElementNS( NS::META, "meta:creation-date", $creation_time ); $this->root->appendChild( $node ); @@ -214,7 +218,7 @@ $this->logger->debug( "meta/Meta->addGenerator: ". $lgenerator ."." ); - $node = $this->dom->createElementNS( self::NS_META, "meta:generator", $lgenerator ); + $node = $this->dom->createElementNS( NS::META, "meta:generator", $lgenerator ); $this->root->appendChild( $node ); @@ -245,7 +249,7 @@ public function getGenerator() { $retValue = ""; - $nodelist = $this->dom->getElementsByTagNameNS( self::NS_META, "generator" ); + $nodelist = $this->dom->getElementsByTagNameNS( NS::META, "generator" ); if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; @@ -263,7 +267,7 @@ */ public function addInitialCreator( $initialCreator ) { $this->logger->debug( "meta/Meta->addInitialCreator: ". $initialCreator ."." ); - $node = $this->dom->createElementNS( self::NS_META, "meta:initial-creator", $initialCreator ); + $node = $this->dom->createElementNS( NS::META, "meta:initial-creator", $initialCreator ); $this->root->appendChild( $node ); } @@ -275,7 +279,7 @@ */ public function getInitialCreator() { $retValue = ""; - $nodelist = $this->dom->getElementsByTagNameNS( self::NS_META, "initial-creator" ); + $nodelist = $this->dom->getElementsByTagNameNS( NS::META, "initial-creator" ); if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } @@ -291,13 +295,13 @@ * @since 0.4.0 */ public function addUserDefinedMetadata( $name, $type, $value ) { - $node = $this->dom->createElementNS( self::NS_META, "meta:user-defined" ); - $node->setAttributeNS( self::NS_META, "meta:name", $name ); + $node = $this->dom->createElementNS( NS::META, "meta:user-defined" ); + $node->setAttributeNS( NS::META, "meta:name", $name ); if ( !empty( $type ) ) { - $node->setAttributeNS( self::NS_META, "meta:type", $type ); + $node->setAttributeNS( NS::META, "meta:type", $type ); } if ( !empty( $value ) ) { - $node->setAttributeNS( self::NS_META, "meta:value", $value ); + $node->setAttributeNS( NS::META, "meta:value", $value ); } $this->root->appendChild( $node ); unset( $node ); Modified: poc/src/samples/TestOutput.php =================================================================== --- poc/src/samples/TestOutput.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/samples/TestOutput.php 2006-03-30 08:24:22 UTC (rev 42) @@ -68,16 +68,16 @@ $svgAttr = array(); $styleAttr[ "font-pitch" ] = "variable"; - $svgAttr [ "font-family" ] = "'Arial Unicode MS'"; + $svgAttr [ "font-family" ] = "'Arial Unicode MS'"; $fontFaceDecl->addFontFace( "Arial Unicode MS", $styleAttr, $svgAttr ); $svgAttr [ "font-family" ] = "Tahoma"; $fontFaceDecl->addFontFace( "Tahoma", $styleAttr, $svgAttr ); - $svgAttr [ "font-family" ] = "'MS Mincho'"; + $svgAttr [ "font-family" ] = "'MS Mincho'"; $fontFaceDecl->addFontFace( "MS Mincho", $styleAttr, $svgAttr ); - $svgAttr [ "font-family" ] = "'Times New Roman'"; + $svgAttr [ "font-family" ] = "'Times New Roman'"; $styleAttr[ "font-family-generic" ] = "roman"; $fontFaceDecl->addFontFace( "Times New Roman", $styleAttr, $svgAttr ); Modified: poc/src/settings/Settings.php =================================================================== --- poc/src/settings/Settings.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/settings/Settings.php 2006-03-30 08:24:22 UTC (rev 42) @@ -16,6 +16,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class Settings extends OpenDocumentObjectAbstract { /** @@ -55,15 +56,15 @@ $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document-settings" ); - $this->root->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document-settings" ); + $this->root->setAttributeNS( NS::OFFICE, "office:version", "1.0" ); $this->settings = $this->dom; } else { // this is part of a single document $this->dom = $dom; $this->settings = $root; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:settings" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:settings" ); } } Modified: poc/src/styles/AutomaticStyles.php =================================================================== --- poc/src/styles/AutomaticStyles.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/AutomaticStyles.php 2006-03-30 08:24:22 UTC (rev 42) @@ -15,6 +15,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class AutomaticStyles extends OpenDocumentObjectAbstract { @@ -44,7 +45,7 @@ $this->logger->debug( "Constructing styles/AutomaticStyles." ); $this->dom = $dom; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:automatic-styles" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:automatic-styles" ); } /** Modified: poc/src/styles/FontFaceDeclaration.php =================================================================== --- poc/src/styles/FontFaceDeclaration.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/FontFaceDeclaration.php 2006-03-30 08:24:22 UTC (rev 42) @@ -13,6 +13,7 @@ * @since 0.4.2 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class FontFaceDeclaration extends OpenDocumentObjectAbstract { @@ -35,7 +36,7 @@ $this->dom = $dom; $this->useDom2 = false; - $this->FontFaceDecl = $this->dom->createElementNS( self::NS_OFFICE, "office:font-face-decls" ); + $this->FontFaceDecl = $this->dom->createElementNS( NS::OFFICE, "office:font-face-decls" ); } /** @@ -114,13 +115,13 @@ * @since 0.4.2 */ public function addFontFace( $name, $styleAttr=0, $SVGAttr=0 ) { - $font = $this->dom->createElementNS( self::NS_STYLE, "style:font-face" ); - $font->setAttributeNS( self::NS_STYLE, "style:name", $name ); + $font = $this->dom->createElementNS( NS::STYLE, "style:font-face" ); + $font->setAttributeNS( NS::STYLE, "style:name", $name ); if (!empty($styleAttr)) { foreach( $styleAttr as $key => $value ) { // ***FIX ME*** Here we should check if the keys are possible if ($this->checkStyle($key, $value)) { - $font->setAttributeNS( self::NS_STYLE, "style:".$key, $value ); + $font->setAttributeNS( NS::STYLE, "style:".$key, $value ); } } } @@ -128,7 +129,7 @@ foreach( $SVGAttr as $key => $value ) { // ***FIX ME*** Here we should check if the keys are possible if ($this->checkSVG( $key, $value )) { - $font->setAttributeNS( self::NS_SVG, "svg:".$key, $value ); + $font->setAttributeNS( NS::SVG, "svg:".$key, $value ); } } } Modified: poc/src/styles/MasterStyles.php =================================================================== --- poc/src/styles/MasterStyles.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/MasterStyles.php 2006-03-30 08:24:22 UTC (rev 42) @@ -15,6 +15,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class MasterStyles extends OpenDocumentObjectAbstract { @@ -43,7 +44,7 @@ $this->dom = $dom; $this->style = $root; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:master-styles" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:master-styles" ); } /** Modified: poc/src/styles/Style.php =================================================================== --- poc/src/styles/Style.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/Style.php 2006-03-30 08:24:22 UTC (rev 42) @@ -13,6 +13,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class Style extends OpenDocumentObjectAbstract { @@ -54,7 +55,7 @@ $this->logger->debug( "Constructing style/Style." ); $this->dom = $dom; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:styles" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:styles" ); $this->Styles = array(); $this->DefaultStyles = array(); @@ -69,9 +70,9 @@ * @since 0.4.2 */ public function addDefaultStyle( $family = 0 ) { - $node = $this->dom->createElementNS( self::NS_STYLE, "style:default-style" ); + $node = $this->dom->createElementNS( NS::STYLE, "style:default-style" ); if (!empty($family)) { - $node->setAttributeNS( self::NS_STYLE, "style:family", $family ); + $node->setAttributeNS( NS::STYLE, "style:family", $family ); } $this->DefaultStyles[ $family ] = $node; } @@ -84,15 +85,15 @@ * @since 0.4.2 */ private function addParagraphPropertiesToNode( $node, $styleAttr, $foAttr ) { - $ParProp = $this->dom->createElementNS( self::NS_STYLE, "style:paragraph-properties" ); + $ParProp = $this->dom->createElementNS( NS::STYLE, "style:paragraph-properties" ); if (!empty($styleAttr)) { foreach( $styleAttr as $key=>$value ) { - $ParProp->setAttributeNS( self::NS_STYLE, "style:".$key, $value ); + $ParProp->setAttributeNS( NS::STYLE, "style:".$key, $value ); } } if (!empty($foAttr)) { foreach( $foAttr as $key=>$value ) { - $ParProp->setAttributeNS( self::NS_FO, "fo:".$key, $value ); + $ParProp->setAttributeNS( NS::FO, "fo:".$key, $value ); } } $node->appendChild( $ParProp ); @@ -106,15 +107,15 @@ * @since 0.4.2 */ private function addTextPropertiesToNode( $node, $styleAttr, $foAttr ) { - $ParProp = $this->dom->createElementNS( self::NS_STYLE, "style:text-properties" ); + $ParProp = $this->dom->createElementNS( NS::STYLE, "style:text-properties" ); if (!empty($styleAttr)) { foreach( $styleAttr as $key=>$value ) { - $ParProp->setAttributeNS( self::NS_STYLE, "style:".$key, $value ); + $ParProp->setAttributeNS( NS::STYLE, "style:".$key, $value ); } } if (!empty($foAttr)) { foreach( $foAttr as $key=>$value ) { - $ParProp->setAttributeNS( self::NS_FO, "fo:".$key, $value ); + $ParProp->setAttributeNS( NS::FO, "fo:".$key, $value ); } } $node->appendChild( $ParProp ); @@ -190,11 +191,11 @@ * @since 0.4.2 */ public function addStyle( $name, $styleAttr=0 ) { - $node = $this->dom->createElementNS( self::NS_STYLE, "style:style" ); - $node->setAttributeNS( self::NS_STYLE, "style:name", $name ); + $node = $this->dom->createElementNS( NS::STYLE, "style:style" ); + $node->setAttributeNS( NS::STYLE, "style:name", $name ); if (!empty($styleAttr)) { foreach( $styleAttr as $key=>$value ) { - $node->setAttributeNS ( self::NS_STYLE, "style:".$key, $value ); + $node->setAttributeNS ( NS::STYLE, "style:".$key, $value ); } } $this->Styles[ $name ] = $node; Modified: poc/src/styles/Styles.php =================================================================== --- poc/src/styles/Styles.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/Styles.php 2006-03-30 08:24:22 UTC (rev 42) @@ -16,6 +16,7 @@ require_once( "styles/Style.php" ); require_once( "styles/AutomaticStyles.php" ); require_once( "styles/MasterStyles.php" ); +require_once( "util/NameSpaces.php" ); class Styles extends OpenDocumentObjectAbstract { @@ -43,8 +44,8 @@ $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document-styles" ); - $this->root->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document-styles" ); + $this->root->setAttributeNS( NS::OFFICE, "office:version", "1.0" ); $this->styles = $this->dom; $this->FontFaceDecl = new FontFaceDeclaration( $this->dom, $this->root ); Added: poc/src/util/NameSpaces.php =================================================================== --- poc/src/util/NameSpaces.php (rev 0) +++ poc/src/util/NameSpaces.php 2006-03-30 08:24:22 UTC (rev 42) @@ -0,0 +1,144 @@ +<?php +/** + * NameSpaces Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage util + * @since 0.5.0 + */ + +class NameSpaces { + + /** + * namespace OpenDocument meta + */ + const META = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; + + /** + * namespace OpenDocument office + */ + const OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0"; + + /** + * namespace OpenDocument manifest + */ + const MANIFEST = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"; + + /** + * namespace OpenDocument style + */ + const STYLE = "urn:oasis:names:tc:opendocument:xmlns:style:1.0"; + + /** + * namespace OpenDocument text + */ + const TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0"; + + /** + * namespace OpenDocument draw + */ + const DRAW = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; + + /** + * namespace OpenDocument table + */ + const TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0"; + + /** + * namespace OpenDocument number + */ + const NUMBER = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; + + /** + * namespace OpenDocument chart + */ + const CHART = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; + + /** + * namespace OpenDocument form + */ + const FORM = "urn:oasis:names:tc:opendocument:xmlns:form:1.0"; + + /** + * namespace OpenDocument config + */ + const CONFIG = "urn:oasis:names:tc:opendocument:xmlns:config:1.0"; + + /** + * namespace OpenDocument presentation + */ + const PRESENTATION = "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"; + + /** + * namespace OpenDocument dr3d + */ + const DR3D = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; + + /** + * namespace OpenDocument animation + */ + const ANIM = "urn:oasis:names:tc:opendocument:xmlns:animation:1.0"; + + /** + * namespace OpenDocument script + */ + const SCRIPT = "urn:oasis:names:tc:opendocument:xmlns:script:1.0"; + + /** + * namespace OpenDocument svg + */ + const SVG = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; + + /** + * namespace OpenDocument fo (formation objects) + */ + const FO = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; + + /** + * namespace OpenDocument smil + */ + const SMIL = "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"; + + /** + * namespace Dublin Core + */ + const DC = "http://purl.org/dc/elements/1.1/"; + + /** + * namespace XLink + */ + const XLINK = "http://www.w3.org/1999/xlink"; + + /** + * namespace XForms + */ + const XFORMS = "http://www.w3.org/2002/xforms"; + + /** + * namespace MathML + */ + const MATHML = "http://www.w3.org/1998/Math/MathML"; + +} + +/** + * This is just a shortcast to the NameSpaces Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @since 0.5.0 + */ +class NS extends NameSpaces { + +}; Property changes on: poc/src/util/NameSpaces.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/util/NameSpacesTest.php =================================================================== --- poc/src/util/NameSpacesTest.php (rev 0) +++ poc/src/util/NameSpacesTest.php 2006-03-30 08:24:22 UTC (rev 42) @@ -0,0 +1,101 @@ +<?php +/** + * TestCase for OpenDocumentObjectAbstract class + * + * $Id$ + * + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @license GNU General Public License + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage UnitTest + * @since 0.5.0 + */ + +require_once "PHPUnit2/Framework/TestCase.php"; +require_once "util/NameSpaces.php"; + +class NameSpaceTest extends PHPUnit2_Framework_TestCase { + +const office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"; +const style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"; +const text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"; +const table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"; +const draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; +const fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; +const xlink="http://www.w3.org/1999/xlink"; +const dc="http://purl.org/dc/elements/1.1/"; +const meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; +const number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; +const svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; +const chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; +const dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; +const math="http://www.w3.org/1998/Math/MathML"; +const form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"; +const script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"; +const ooo="http://openoffice.org/2004/office"; +const ooow="http://openoffice.org/2004/writer"; +const oooc="http://openoffice.org/2004/calc"; +const dom="http://www.w3.org/2001/xml-events"; + + /** + * This test will check all name spaces. The namespaces in this file are extracted from + * an OpenOffice document, so they are not written by hand out of the OpenDocument documentation. + * This should help to fix typos. (And it did!!!) + * + * @since 0.5.0 + */ + function testNamespaces() { + $this->assertEquals( NameSpaces::OFFICE, self::office ); + $this->assertEquals( NameSpaces::STYLE, self::style ); + $this->assertEquals( NameSpaces::TEXT, self::text ); + $this->assertEquals( NameSpaces::TABLE, self::table ); + $this->assertEquals( NameSpaces::DRAW, self::draw ); + $this->assertEquals( NameSpaces::FO, self::fo ); + $this->assertEquals( NameSpaces::XLINK, self::xlink ); + $this->assertEquals( NameSpaces::DC, self::dc ); + $this->assertEquals( NameSpaces::META, self::meta ); + $this->assertEquals( NameSpaces::NUMBER, self::number ); + $this->assertEquals( NameSpaces::SVG, self::svg ); + $this->assertEquals( NameSpaces::CHART, self::chart ); + $this->assertEquals( NameSpaces::DR3D, self::dr3d ); + $this->assertEquals( NameSpaces::MATHML, self::math ); + $this->assertEquals( NameSpaces::FORM, self::form ); + $this->assertEquals( NameSpaces::SCRIPT, self::script ); +/* + $this->assertEquals( NameSpace::OOO, self::ooo ); + $this->assertEquals( NameSpace::OOOW, self::ooow ); + $this->assertEquals( NameSpace::OOOC, self::oooc ); + $this->assertEquals( NameSpace::DOM, self::dom ); +*/ + } + + /** + * This test will check all name spaces. The namespaces in this file are extracted from + * an OpenOffice document, so they are not written by hand out of the OpenDocument documentation. + * This should help to fix typos. (And it did!!!) + * + * @since 0.5.0 + */ + function testNS() { + $this->assertEquals( NS::OFFICE, self::office ); + $this->assertEquals( NS::STYLE, self::style ); + $this->assertEquals( NS::TEXT, self::text ); + $this->assertEquals( NS::TABLE, self::table ); + $this->assertEquals( NS::DRAW, self::draw ); + $this->assertEquals( NS::FO, self::fo ); + $this->assertEquals( NS::XLINK, self::xlink ); + $this->assertEquals( NS::DC, self::dc ); + $this->assertEquals( NS::META, self::meta ); + $this->assertEquals( NS::NUMBER, self::number ); + $this->assertEquals( NS::SVG, self::svg ); + $this->assertEquals( NS::CHART, self::chart ); + $this->assertEquals( NS::DR3D, self::dr3d ); + $this->assertEquals( NS::MATHML, self::math ); + $this->assertEquals( NS::FORM, self::form ); + $this->assertEquals( NS::SCRIPT, self::script ); + } + +} +?> \ No newline at end of file Property changes on: poc/src/util/NameSpacesTest.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |