104 global $xsd_simple_type;
105 if (!is_array($this->outputVars) or !
count($this->outputVars))
112 $typeDeclaration =
"";
113 if (isset($this->outputVars[
$name]))
114 $typeDeclaration = $this->outputVars[
$name];
115 else if (isset($this->typensVars[
$name]))
116 $typeDeclaration = $this->typensVars[
$name];
117 else if (isset($this->typensVars[$complexDataTypeName][
$name]))
118 $typeDeclaration = $this->typensVars[$complexDataTypeName][
$name];
120 if (isset($typeDeclaration[
"varType"]))
121 $dataType = $typeDeclaration[
"varType"];
125 if (isset($xsd_simple_type[$dataType]))
126 $dataType = $xsd_simple_type[$dataType];
137 $node->setData($value);
145 if ( $value ===
true )
146 $node->setData(
"true" );
148 $node->setData(
"false" );
156 $node->setData( intval($value) );
165 $node->setData($value);
174 $node->setData(base64_encode($value));
182 if (is_object($value))
184 if (get_class($value) ==
'CDataXML')
186 elseif (get_class($value) ==
'CDataXMLDocument')
188 elseif(get_class($value) ==
'CXMLCreator')
189 $node->addChild($value);
194 if (
$data->LoadString($value))
197 $node->setData($value);
207 if (isset($typeDeclaration[
"arrType"]))
209 if (!isset($typeDeclaration[
"varType"]))
212 $varType = $typeDeclaration[
"varType"];
217 $arrayType = $typeDeclaration[
"arrType"];
218 if (isset($typeDeclaration[
"maxOccursA"]))
219 $maxOccurs = $typeDeclaration[
"maxOccursA"];
221 if (isset($xsd_simple_type[$arrayType]))
224 $arrayType = $xsd_simple_type[$arrayType];
225 $arrayTypeEl = $varType.
"El";
226 if (!is_array($value))
229 foreach ($value as $valnode)
234 $cndata->setData($valnode);
235 $node->addChild($cndata);
237 if (intval($maxOccurs)>0 and
$i>$maxOccurs)
246 $arrayTypeEl = $varType.
"El";
247 if (!is_array($value))
250 foreach ($value as $valnode)
256 $decoded = $this->
encodeValue( $arrayType, $valnode );
263 $decoded->setName($arrayTypeEl);
264 $node->addChild($decoded);
267 if (intval($maxOccurs)>0 and
$i>$maxOccurs)
278 $returnValue =
array();
281 if (!isset($this->typensVars[$dataType]))
break;
282 $objectDecl = $this->typensVars[$dataType];
292 $serialize =
"assoc";
293 if (isset($objectDecl[
"serialize"]))
295 $serialize = $objectDecl[
"serialize"];
296 unset($objectDecl[
"serialize"]);
300 if ($serialize ==
"assoc")
302 if ($serialize !=
"assoc")
305 foreach($objectDecl as $pname => $param)
309 if (isset($param[
"strict"])) $strict = ($param[
"strict"]==
"strict")?
true:
false;
311 if ($serialize ==
"assoc")
314 if (isset($value[$pname]))
315 $decoded = $this->
encodeValue( $pname, $value[$pname], $dataType );
318 if ($serialize !=
"assoc")
320 if (isset($value->$pname))
321 $decoded = $this->
encodeValue( $pname, $value->$pname, $dataType );
328 if (!$decoded and $strict)
334 $node->addChild($decoded);