[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.xmltool.inc.php,1.1,1.2
From: |
Dan Kuykendall <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.xmltool.inc.php,1.1,1.2 |
Date: |
Fri, 20 Sep 2002 20:24:14 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv10503
Modified Files:
class.xmltool.inc.php
Log Message:
Have importing of vars and xml working on any node
Index: class.xmltool.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.xmltool.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.xmltool.inc.php 17 Sep 2002 16:42:50 -0000 1.1
--- class.xmltool.inc.php 21 Sep 2002 00:24:11 -0000 1.2
***************
*** 8,22 ****
class xmltool
{
! /* shared */
! var $node_type = '';
! var $comments = Array();
! /* for docs */
var $xmlversion = '1.0';
var $doctype = Array();
! var $root_node;
! /* for nodes */
var $name = '';
- var $data;
var $data_type;
var $attributes = Array();
var $comments = Array();
--- 8,20 ----
class xmltool
{
! /* for root nodes */
var $xmlversion = '1.0';
var $doctype = Array();
! /* shared */
! var $node_type = '';
var $name = '';
var $data_type;
+ var $data;
+ /* for nodes */
var $attributes = Array();
var $comments = Array();
***************
*** 41,76 ****
}
- function add_root ($node_object)
- {
- if ($this->node_type == 'root')
- {
- if(is_object($node_object))
- {
- $this->root_node = $node_object;
- }
- else
- {
- echo 'Not a valid xmltool node
object<br>';
- exit;
- }
- }
- else
- {
- echo 'add_root can only be used by a root
object<br>';
- exit;
- }
- }
-
function set_version ($version = '1.0')
{
! if ($this->node_type == 'node')
! {
! $this->xmlversion = $version;
! }
! else
! {
! echo 'set_version can only be used by a root
object<br>';
! exit;
! }
}
--- 39,46 ----
}
function set_version ($version = '1.0')
{
! $this->xmlversion = $version;
! return True;
}
***************
*** 80,113 ****
{
$this->doctype[$name] = $uri;
}
else
{
! echo 'set_doctype can only be used by a root
object<br>';
! exit;
}
}
! function add_node ($node_object , $name = '')
{
! if ($this->node_type == 'node')
{
! if (is_object($node_object))
! {
! if(!is_array($this->data))
! {
! $this->data = Array();
! $this->data_type = 'node';
! }
! if ($name != '')
{
! $this->data[$name] =
$node_object;
}
else
{
! $this->data[] = $node_object;
}
! }
! else
! {
if(!is_array($this->data))
{
--- 50,76 ----
{
$this->doctype[$name] = $uri;
+ return True;
}
else
{
! return False;
}
}
! function add_node ($node_object, $name = '')
{
! switch ($this->node_type)
{
! case 'root':
! if (is_object($node_object))
{
! $this->data = $node_object;
}
else
{
! $this->data =
$this->import_var($name, $node_object);
}
! break;
! case 'node':
if(!is_array($this->data))
{
***************
*** 115,126 ****
$this->data_type = 'node';
}
! $this->data[$name] =
$this->import_var($name, $node_object);
! }
}
! else
{
! echo 'root objects should use add_root to
create the root node<br>';
! exit;
}
}
--- 78,113 ----
$this->data_type = 'node';
}
! if (is_object($node_object))
! {
! if ($name != '')
! {
! $this->data[$name] =
$node_object;
! }
! else
! {
! $this->data[] =
$node_object;
! }
! }
! else
! {
! $this->data[$name] =
$this->import_var($name, $node_object);
! }
! return True;
! break;
}
! }
!
! function get_node ($name = '')
! {
! switch ($this->data_type)
{
! case 'root':
! break;
! case 'node':
! break;
! case 'object':
! break;
}
+
}
***************
*** 129,132 ****
--- 116,120 ----
$this->data = $string;
$this->data_type = 'value';
+ return True;
}
***************
*** 140,145 ****
{
return False;
- //echo 'get_value can only be used on data type
of value.<br>';
- exit;
}
}
--- 128,131 ----
***************
*** 147,159 ****
function set_attribute ($name, $value = '')
{
! if ($this->node_type == 'node')
! {
! $this->attributes[$name] = $value;
! }
! else
! {
! echo 'set_attribute can only be used by a node
object<br>';
! exit;
! }
}
--- 133,138 ----
function set_attribute ($name, $value = '')
{
! $this->attributes[$name] = $value;
! return True;
}
***************
*** 171,174 ****
--- 150,154 ----
{
$this->comments[] = $comment;
+ return True;
}
***************
*** 285,289 ****
if($is_root)
{
! $this->add_root($node);
if($export_xml)
{
--- 265,269 ----
if($is_root)
{
! $this->add_node($node);
if($export_xml)
{
***************
*** 298,301 ****
--- 278,282 ----
else
{
+ $this->add_node($node);
return $node;
}
***************
*** 304,313 ****
function export_var ($is_start = True)
{
! if($is_start)
{
! //$xmldata = xml_get_tree($xmldata);
}
! if($this->datatype != 'node')
{
$data = $this->data;
--- 285,300 ----
function export_var ($is_start = True)
{
! switch ($this->data_type)
{
! case 'root':
! break;
! case 'node':
! break;
! case 'object':
! break;
}
!
! if($this->data_type != 'node')
{
$data = $this->data;
***************
*** 318,329 ****
$data = unserialize ($xmldata['value']);
}
! if($is_start)
! {
! $xml_array[$this->data] = $data;
! }
! else
! {
return $data;
! }
}
else
--- 305,316 ----
$data = unserialize ($xmldata['value']);
}
! //if($is_start)
! //{
! // $xml_array[$this->data] = $data;
! //}
! //else
! //{
return $data;
! //}
}
else
***************
*** 431,442 ****
exit;
}
! if($this->node_type == 'root')
! {
! $this->add_root($node);
! }
! else
! {
! $this->add_node($node);
! }
}
--- 418,422 ----
exit;
}
! $this->add_node($node);
}
***************
*** 459,466 ****
}
}
! if(is_object($this->root_node))
{
$indent = 0;
! $result .=
$this->root_node->export_xml($indent);
}
return $result;
--- 439,446 ----
}
}
! if(is_object($this->data))
{
$indent = 0;
! $result .=
$this->data->export_xml($indent);
}
return $result;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.xmltool.inc.php,1.1,1.2,
Dan Kuykendall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property list_workorder.php,1.6,1.7 list_invoice.php,1.5,1.6 list_property_value.php,1.3,1.4 property_value_history.php,1.2,1.3
- Next by Date:
[Phpgroupware-cvs] CVS: phpgwapi/doc/vfs vfs-1.html,1.2,1.3 vfs-2.html,1.3,1.4 vfs-3.html,1.3,1.4 vfs-4.html,1.3,1.4 vfs-5.html,1.2,1.3 vfs-6.html,1.3,1.4 vfs-7.html,1.2,1.3 vfs.html,1.3,1.4 vfs.lyx,1.3,1.4 vfs.sgml,1.3,1.4 vfs.txt,1.3,1.4
- Previous by thread:
[Phpgroupware-cvs] CVS: property list_workorder.php,1.6,1.7 list_invoice.php,1.5,1.6 list_property_value.php,1.3,1.4 property_value_history.php,1.2,1.3
- Next by thread:
[Phpgroupware-cvs] CVS: phpgwapi/doc/vfs vfs-1.html,1.2,1.3 vfs-2.html,1.3,1.4 vfs-3.html,1.3,1.4 vfs-4.html,1.3,1.4 vfs-5.html,1.2,1.3 vfs-6.html,1.3,1.4 vfs-7.html,1.2,1.3 vfs.html,1.3,1.4 vfs.lyx,1.3,1.4 vfs.sgml,1.3,1.4 vfs.txt,1.3,1.4
- Index(es):