home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / example2.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  1.9 KB  |  67 lines

  1. <?PHP
  2.     require_once 'XML/Util.php';
  3.  
  4.     /**
  5.     * creating a start element
  6.     */
  7.     print "creating a start element:<br>";
  8.     print htmlentities(XML_Util::createStartElement("myNs:myTag", array("foo" => "bar"), "http://www.w3c.org/myNs#"));
  9.     print "\n<br><br>\n";
  10.  
  11.  
  12.     /**
  13.     * creating a start element
  14.     */
  15.     print "creating a start element:<br>";
  16.     print htmlentities(XML_Util::createStartElement("myTag", array(), "http://www.w3c.org/myNs#"));
  17.     print "\n<br><br>\n";
  18.  
  19.     /**
  20.     * creating a start element
  21.     */
  22.     print "creating a start element:<br>";
  23.     print "<pre>";
  24.     print htmlentities(XML_Util::createStartElement("myTag", array( "foo" => "bar", "argh" => "tomato" ), "http://www.w3c.org/myNs#", true));
  25.     print "</pre>";
  26.     print "\n<br><br>\n";
  27.  
  28.  
  29.     /**
  30.     * creating an end element
  31.     */
  32.     print "creating an end element:<br>";
  33.     print htmlentities(XML_Util::createEndElement("myNs:myTag"));
  34.     print "\n<br><br>\n";
  35.  
  36.     /**
  37.     * creating a CData section
  38.     */
  39.     print "creating a CData section:<br>";
  40.     print htmlentities(XML_Util::createCDataSection("I am content."));
  41.     print "\n<br><br>\n";
  42.  
  43.     /**
  44.     * creating a comment
  45.     */
  46.     print "creating a comment:<br>";
  47.     print htmlentities(XML_Util::createComment("I am a comment."));
  48.     print "\n<br><br>\n";
  49.  
  50.     /**
  51.     * creating an XML tag with multiline mode
  52.     */
  53.     $tag = array(
  54.                   "qname"        => "foo:bar",
  55.                   "namespaceUri" => "http://foo.com",
  56.                   "attributes"   => array( "key" => "value", "argh" => "fruit&vegetable" ),
  57.                   "content"      => "I'm inside the tag & contain dangerous chars"
  58.                 );
  59.  
  60.     print "creating a tag with qualified name and namespaceUri:<br>\n";
  61.     print "<pre>";
  62.     print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_REPLACE_ENTITIES, true));
  63.     print "</pre>";
  64.     print "\n<br><br>\n";
  65.  
  66.  
  67. ?>