";
print htmlentities(XML_Util::createStartElement("myNs:myTag", array("foo" => "bar"), "http://www.w3c.org/myNs#"));
print "\n
\n";
/**
* creating a start element
*/
print "creating a start element:
";
print htmlentities(XML_Util::createStartElement("myTag", array(), "http://www.w3c.org/myNs#"));
print "\n
\n";
/**
* creating a start element
*/
print "creating a start element:
";
print "
";
print htmlentities(XML_Util::createStartElement("myTag", array( "foo" => "bar", "argh" => "tomato" ), "http://www.w3c.org/myNs#", true));
print "";
print "\n
\n";
/**
* creating an end element
*/
print "creating an end element:
";
print htmlentities(XML_Util::createEndElement("myNs:myTag"));
print "\n
\n";
/**
* creating a CData section
*/
print "creating a CData section:
";
print htmlentities(XML_Util::createCDataSection("I am content."));
print "\n
\n";
/**
* creating a comment
*/
print "creating a comment:
";
print htmlentities(XML_Util::createComment("I am a comment."));
print "\n
\n";
/**
* creating an XML tag with multiline mode
*/
$tag = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag & contain dangerous chars"
);
print "creating a tag with qualified name and namespaceUri:
\n";
print "";
print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_REPLACE_ENTITIES, true));
print "";
print "\n
\n";
/**
* create an attribute string without replacing the entities
*/
$atts = array( 'series' => 'Starsky & Hutch', 'channel' => 'ABC' );
print "creating a attribute string, entities in values already had been replaced:
";
print htmlentities(XML_Util::attributesToString($atts, true, false, false, false, XML_UTIL_ENTITIES_NONE));
print "\n
\n";
/**
* using the array-syntax for attributesToString()
*/
$atts = array( 'series' => 'Starsky & Hutch', 'channel' => 'ABC' );
print "using the array-syntax for attributesToString()
";
print htmlentities(XML_Util::attributesToString($atts, array('entities' => XML_UTIL_ENTITIES_NONE)));
print "\n
\n";
?>