\n"; print XML_Util::replaceEntities("This string contains < & >."); print "\n

\n"; /** * reversing XML entities */ print "replace XML entities:
\n"; print XML_Util::reverseEntities("This string contains < & >."); print "\n

\n"; /** * building XML declaration */ print "building XML declaration:
\n"; print htmlspecialchars(XML_Util::getXMLDeclaration()); print "\n

\n"; print "building XML declaration with additional attributes:
"; print htmlspecialchars(XML_Util::getXMLDeclaration("1.0", "UTF-8", true)); print "\n

\n"; /** * building document type declaration */ print "building DocType declaration:
\n"; print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 'http://pear.php.net/dtd/package-1.0')); print "\n

\n"; print "building DocType declaration with public ID (does not exist):
\n"; print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', array('uri' => 'http://pear.php.net/dtd/package-1.0', 'id' => '-//PHP//PEAR/DTD PACKAGE 0.1'))); print "\n

\n"; print "building DocType declaration with internal DTD:
\n"; print "
";
    print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 'http://pear.php.net/dtd/package-1.0', ''));
    print "
"; print "\n

\n"; /** * creating an attribute string */ $att = array( "foo" => "bar", "argh" => "tomato" ); print "converting array to string:
\n"; print XML_Util::attributesToString($att); print "\n

\n"; /** * creating an attribute string with linebreaks */ $att = array( "foo" => "bar", "argh" => "tomato" ); print "converting array to string (including line breaks):
\n"; print "
";
    print XML_Util::attributesToString($att, true, true);
    print "
"; print "\n

\n"; /** * splitting a qualified tag name */ print "splitting qualified tag name:
\n"; print "
";
    print_r(XML_Util::splitQualifiedName("xslt:stylesheet"));
    print "
"; print "\n
\n"; /** * splitting a qualified tag name (no namespace) */ print "splitting qualified tag name (no namespace):
\n"; print "
";
    print_r(XML_Util::splitQualifiedName("foo"));
    print "
"; print "\n
\n"; /** * splitting a qualified tag name (no namespace, but default namespace specified) */ print "splitting qualified tag name (no namespace, but default namespace specified):
\n"; print "
";
    print_r(XML_Util::splitQualifiedName("foo", "bar"));
    print "
"; print "\n
\n"; /** * verifying XML names */ print "verifying 'My private tag':
\n"; print "
";
    print_r(XML_Util::isValidname('My Private Tag'));
    print "
"; print "\n

\n"; print "verifying '-MyTag':
\n"; print "
";
    print_r(XML_Util::isValidname('-MyTag'));
    print "
"; print "\n

\n"; /** * creating an XML tag */ $tag = array( "namespace" => "foo", "localPart" => "bar", "attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ), "content" => "I'm inside the tag" ); print "creating a tag with namespace and local part:
"; print htmlentities(XML_Util::createTagFromArray($tag)); print "\n

\n"; /** * creating an XML tag */ $tag = array( "qname" => "foo:bar", "namespaceUri" => "http://foo.com", "attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ), "content" => "I'm inside the tag" ); print "creating a tag with qualified name and namespaceUri:
\n"; print htmlentities(XML_Util::createTagFromArray($tag)); print "\n

\n"; /** * creating an XML tag */ $tag = array( "qname" => "bar", "namespaceUri" => "http://foo.com", "attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ) ); print "creating an empty tag without namespace but namespace Uri:
\n"; print htmlentities(XML_Util::createTagFromArray($tag)); print "\n

\n"; /** * creating an XML tag with a CData Section */ $tag = array( "qname" => "foo", "attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ), "content" => "I'm inside the tag" ); print "creating a tag with CData section:
\n"; print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_CDATA_SECTION)); print "\n

\n"; /** * creating an XML tag with a CData Section */ $tag = array( "qname" => "foo", "attributes" => array( "key" => "value", "argh" => "tütü" ), "content" => "Also XHTML-tags can be created and HTML entities can be replaced Ä ä Ü ö <>." ); print "creating a tag with HTML entities:
\n"; print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_ENTITIES_HTML)); print "\n

\n"; /** * creating an XML tag with createTag */ print "creating a tag with createTag:
"; print htmlentities(XML_Util::createTag("myNs:myTag", array("foo" => "bar"), "This is inside the tag", "http://www.w3c.org/myNs#")); print "\n

\n"; /** * trying to create an XML tag with an array as content */ $tag = array( "qname" => "bar", "content" => array( "foo" => "bar" ) ); print "trying to create an XML tag with an array as content:
\n"; print "
";
    print_r(XML_Util::createTagFromArray($tag));
    print "
"; print "\n

\n"; /** * trying to create an XML tag without a name */ $tag = array( "attributes" => array( "foo" => "bar" ), ); print "trying to create an XML tag without a name:
\n"; print "
";
    print_r(XML_Util::createTagFromArray($tag));
    print "
"; print "\n

\n"; ?>