|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // $Id$ 00004 // 00005 // Definition of eZSchemaElement class 00006 // 00007 // Bård Farstad <bf@ez.no> 00008 // Created on: <13-Feb-2002 10:58:53 bf> 00009 // 00010 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00011 // SOFTWARE NAME: eZ Publish 00012 // SOFTWARE RELEASE: 4.0.x 00013 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00014 // SOFTWARE LICENSE: GNU General Public License v2.0 00015 // NOTICE: > 00016 // This program is free software; you can redistribute it and/or 00017 // modify it under the terms of version 2.0 of the GNU General 00018 // Public License as published by the Free Software Foundation. 00019 // 00020 // This program is distributed in the hope that it will be useful, 00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 // GNU General Public License for more details. 00024 // 00025 // You should have received a copy of version 2.0 of the GNU General 00026 // Public License along with this program; if not, write to the Free 00027 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00028 // MA 02110-1301, USA. 00029 // 00030 // 00031 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00032 // 00033 00034 /*! 00035 \class eZSchemaElement ezschemaelement.php 00036 \ingroup eZXML 00037 \brief eZSchemaElement handles schema validation elements 00038 00039 */ 00040 00041 class eZSchemaElement 00042 { 00043 /*! 00044 Constructs a new eZSchemaElement object. 00045 */ 00046 function eZSchemaElement() 00047 { 00048 } 00049 00050 /*! 00051 Sets the elment name 00052 */ 00053 function setName( $name ) 00054 { 00055 $this->Name = $name; 00056 } 00057 00058 /*! 00059 Returns the name of the schema element. 00060 */ 00061 function name() 00062 { 00063 return $this->Name; 00064 } 00065 00066 /*! 00067 Sets the type of the element, can either be simpleType, complexType or reference. 00068 */ 00069 function setType( $type ) 00070 { 00071 if ( $type == "complexType" ) 00072 $this->Type = "complexType"; 00073 else if ( $type == "reference" ) 00074 $this->Type = "reference"; 00075 else 00076 $this->Type = "simpleType"; 00077 } 00078 00079 /*! 00080 Returns the schema element type. 00081 */ 00082 function type() 00083 { 00084 return $this->Type; 00085 } 00086 00087 /*! 00088 Sets the datatype of the element. 00089 */ 00090 function setDataType( $type ) 00091 { 00092 $this->DataType = $type; 00093 } 00094 00095 /*! 00096 The data type for simple types. False if not set. 00097 */ 00098 function dataType() 00099 { 00100 return $this->DataType; 00101 } 00102 00103 /*! 00104 Returns true if the type is complex, false if it's a simpletpe. 00105 */ 00106 function isComplex() 00107 { 00108 if ( $this->Type == "complexType" ) 00109 return true; 00110 else 00111 return false; 00112 } 00113 00114 /*! 00115 Returns true if the element is a reference. 00116 */ 00117 function isReference() 00118 { 00119 if ( $this->Type == "reference" ) 00120 return true; 00121 else 00122 return false; 00123 } 00124 00125 /*! 00126 Returns true if the type is a simple type, false if it's a complex type. 00127 */ 00128 function isSimple() 00129 { 00130 if ( $this->Type == "simpleType" ) 00131 return true; 00132 else 00133 return false; 00134 } 00135 00136 /*! 00137 Sets the minum number of occurances for this element 00138 */ 00139 function setMinOccurs( $value ) 00140 { 00141 $this->MinOccurs = $value; 00142 } 00143 00144 /*! 00145 Returns the minimum number of occurances of this element. 00146 */ 00147 function minOccurs() 00148 { 00149 return $this->MinOccurs; 00150 } 00151 00152 /*! 00153 Sets the maximum number of occurances for this element 00154 */ 00155 function setMaxOccurs( $value ) 00156 { 00157 $this->MaxOccurs = $value; 00158 } 00159 00160 /*! 00161 Returns the maximum number of occurances of this element. 00162 */ 00163 function maxOccurs() 00164 { 00165 return $this->MaxOccurs; 00166 } 00167 00168 /*! 00169 Returns the children nodes for this schema element. 00170 */ 00171 function children() 00172 { 00173 return $this->Children; 00174 } 00175 00176 /*! 00177 Sets the reference identifier. 00178 */ 00179 function setReference( $value ) 00180 { 00181 $this->Reference = $value; 00182 $this->Type = "reference"; 00183 } 00184 00185 /*! 00186 Sets the parent element 00187 */ 00188 function setParent( $element ) 00189 { 00190 $this->ParentElement = $element; 00191 } 00192 00193 /*! 00194 Returns the parent element. False 00195 */ 00196 function parentElement() 00197 { 00198 return $this->ParentElement; 00199 } 00200 00201 /*! 00202 Sets the next element 00203 */ 00204 function setNext( $element ) 00205 { 00206 $this->NextElement = $element; 00207 } 00208 00209 /*! 00210 Returns the next element. False 00211 */ 00212 function nextElement() 00213 { 00214 return $this->NextElement; 00215 } 00216 00217 /// Reference to element 00218 public $Reference = false; 00219 00220 /// The name of the element 00221 public $Name = ""; 00222 00223 /// The minimum number of occurances of the element 00224 public $MinOccurs = 1; 00225 00226 /// The maximum number of occurances of the element 00227 public $MaxOccurs = 1; 00228 00229 /// The schema type 00230 public $Type = "simpleType"; 00231 00232 /// The next element in the schema 00233 public $NextElement = false; 00234 00235 /// The datatype of the element 00236 public $DataType = false; 00237 00238 /// The parent element 00239 public $ParentElement = false; 00240 00241 /// The sub elements of this element 00242 public $Children = array(); 00243 } 00244 00245 ?>