diff --git a/phpgwapi/doc/xml/xmltool_tester.php b/phpgwapi/doc/xml/xmltool_tester.php new file mode 100644 index 0000000000..374de344b5 --- /dev/null +++ b/phpgwapi/doc/xml/xmltool_tester.php @@ -0,0 +1,138 @@ +\n"; +$nav = 'navigation: initial array | export_xml | import_xml | export_var | export_struct
'."\n"; + +echo ''; +echo $nav; +echo "This is the result of print_r(\$myarr); \$myarr is the multi-dimensional array we which have defined in the file.\n"; +echo "note: notice the last element of the array is an object. xmltool will handle this as well\n"; +echo "
\n";
+print_r($myarr);
+echo "
\n"; + +/* Now to auto-convert to an xmltool object */ +echo '
'; +echo '
'; +echo '
'; +echo $nav; +echo "The array has been auto converted to XML. This can be done in any of the following three ways
\n"; +echo "Long method:
\n\n \$doc = new xmltool();
\n \$doc->import_var('myarr',\$myarr,True);
\n \$xml_result = \$doc->export_xml();
\n

\n"; +echo "Immediate export method:
\n\n \$doc = new xmltool();
\n \$xml_result = \$doc->import_var('myarr',\$myarr,True,true);
\n

\n"; +echo "Super quick method which uses the var2xml() companion function:
\n\n \$xml_result = \$var2xml(\$myarr);
\n

\n"; + +$doc = new xmltool(); +$xml_result = $doc->import_var('myarr',$myarr,True,true); +$somexmldoc = $xml_result; +echo "The gnerated XML doc:\n"; +echo "
\n";
+echo htmlentities($xml_result);
+echo "
\n"; + +echo '
'; +echo '
'; +echo '
'; +echo $nav; +echo "Now we look at importing an XML doc. We can use the one we just created as an example.\n"; +echo "
\n \$doc = new xmltool();
\n \$doc->import_xml(\$xml_result);
\n

\n"; + +$doc = new xmltool(); +$doc->import_xml($xml_result); + +echo "This is the result of print_r(\$doc); which shows the object tree\n"; +echo "
\n";
+print_r($doc);
+echo "
\n"; + +$cnode = new xmltool('node','newnode'); +$cnode->import_var('blah',$myarr); +echo "
\nThis is the result of print_r(\$cnode); which shows the object tree\n"; +echo "
\n";
+print_r($cnode);
+echo "
\n"; + +//$doc->data->data[3]->import_xml($xml_result); +//$doc->data->data[3]->import_var('blah',$myarr); +$xml_result = $doc->export_xml(); + +echo '
'; +echo '
'; +echo "The generated XML doc:\n"; +echo "
\n";
+echo htmlentities($xml_result);
+echo "
\n"; + +echo '
'; +echo '
'; +echo '
'; +echo $nav; +echo "We can export to an array like this
\n"; +echo "\$result_array = \$doc->export_var();
\n

\n"; + +$result_array = $doc->export_var(); + +echo "This is the result of print_r(\$result_array);\n"; +echo "
\n";
+print_r($result_array);
+echo "
\n"; + +echo '
'; +echo '
'; +echo '
'; +echo $nav; +echo "We can export to a struct like this
\n"; +echo "\$result_struct = \$doc->export_struct();
\n

\n"; + +$result_struct = $doc->export_struct(); + +echo "This is the result of print_r(\$result_struct);\n"; +echo "
\n";
+print_r($result_struct);
+echo "
\n"; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; +echo '
'; + +echo ""; +?> diff --git a/phpgwapi/doc/xml/xmltool_tester.xml b/phpgwapi/doc/xml/xmltool_tester.xml new file mode 100644 index 0000000000..973e58bce9 --- /dev/null +++ b/phpgwapi/doc/xml/xmltool_tester.xml @@ -0,0 +1,37 @@ + + + base color + base color + base color + + yellow + blue + + + yellow + red + + one + two + three + + + four + five + six + + + + + + + hello + + + + + + + + +