cvs: pear /XML_Util/examples example.php example2.php
[email protected] ("Chuck Burgess") Mon, 05 May 2008 19:03:13 -0000
| Newsgroups | php.pear.cvs |
|---|---|
| Message-ID | <cvsashnazg1210014193@cvsserver> |
ashnazg Mon May 5 19:03:13 2008 UTC
Modified files:
/pear/XML_Util/examples example2.php example.php
Log:
replace doublequote with singlequote where appropriate
ashnazg-20080505190313.txt
(text/plain, 16.1 KB)
http://cvs.php.net/viewvc.cgi/pear/XML_Util/examples/example2.php?r1=1.10&r2=1.11&diff_format=u Index: pear/XML_Util/examples/example2.php diff -u pear/XML_Util/examples/example2.php:1.10 pear/XML_Util/examples/example2.php:1.11 --- pear/XML_Util/examples/example2.php:1.10 Sun May 4 23:35:05 2008 +++ pear/XML_Util/examples/example2.php Mon May 5 19:03:13 2008 @@ -44,7 +44,7 @@ * @author Stephan Schmidt <[email protected]> * @copyright 2003-2008 Stephan Schmidt <[email protected]> * @license http://opensource.org/licenses/bsd-license New BSD License - * @version CVS: $Id: example2.php,v 1.10 2008/05/04 23:35:05 ashnazg Exp $ + * @version CVS: $Id: example2.php,v 1.11 2008/05/05 19:03:13 ashnazg Exp $ * @link http://pear.php.net/package/XML_Util */ @@ -58,76 +58,76 @@ /** * creating a start element */ - print "creating a start element:<br>"; - print htmlentities(XML_Util::createStartElement("myNs:myTag", - array("foo" => "bar"), "http://www.w3c.org/myNs#")); + print 'creating a start element:<br>'; + print htmlentities(XML_Util::createStartElement('myNs:myTag', + array('foo' => 'bar'), 'http://www.w3c.org/myNs#')); print "\n<br><br>\n"; /** * creating a start element */ - print "creating a start element:<br>"; - print htmlentities(XML_Util::createStartElement("myTag", - array(), "http://www.w3c.org/myNs#")); + print 'creating a start element:<br>'; + print htmlentities(XML_Util::createStartElement('myTag', + array(), 'http://www.w3c.org/myNs#')); print "\n<br><br>\n"; /** * creating a start element */ - print "creating a start element:<br>"; - print "<pre>"; - print htmlentities(XML_Util::createStartElement("myTag", - array("foo" => "bar", "argh" => "tomato"), - "http://www.w3c.org/myNs#", true)); - print "</pre>"; + print 'creating a start element:<br>'; + print '<pre>'; + print htmlentities(XML_Util::createStartElement('myTag', + array('foo' => 'bar', 'argh' => 'tomato'), + 'http://www.w3c.org/myNs#', true)); + print '</pre>'; print "\n<br><br>\n"; /** * creating an end element */ - print "creating an end element:<br>"; - print htmlentities(XML_Util::createEndElement("myNs:myTag")); + print 'creating an end element:<br>'; + print htmlentities(XML_Util::createEndElement('myNs:myTag')); print "\n<br><br>\n"; /** * creating a CData section */ - print "creating a CData section:<br>"; - print htmlentities(XML_Util::createCDataSection("I am content.")); + print 'creating a CData section:<br>'; + print htmlentities(XML_Util::createCDataSection('I am content.')); print "\n<br><br>\n"; /** * creating a comment */ - print "creating a comment:<br>"; - print htmlentities(XML_Util::createComment("I am a comment.")); + print 'creating a comment:<br>'; + print htmlentities(XML_Util::createComment('I am a comment.')); print "\n<br><br>\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" + '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:<br>\n"; - print "<pre>"; + print 'creating a tag with qualified name and namespaceUri:<br>'; + print '<pre>'; print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_REPLACE_ENTITIES, true)); - print "</pre>"; + print '</pre>'; print "\n<br><br>\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:<br>"; + print 'creating a attribute string, ' + . 'entities in values already had been replaced:<br>'; print htmlentities(XML_Util::attributesToString($atts, true, false, false, false, XML_UTIL_ENTITIES_NONE)); print "\n<br><br>\n"; @@ -136,7 +136,7 @@ * using the array-syntax for attributesToString() */ $atts = array('series' => 'Starsky & Hutch', 'channel' => 'ABC'); - print "using the array-syntax for attributesToString()<br>"; + print 'using the array-syntax for attributesToString()<br>'; print htmlentities(XML_Util::attributesToString($atts, array('entities' => XML_UTIL_ENTITIES_NONE))); print "\n<br><br>\n"; http://cvs.php.net/viewvc.cgi/pear/XML_Util/examples/example.php?r1=1.15&r2=1.16&diff_format=u Index: pear/XML_Util/examples/example.php diff -u pear/XML_Util/examples/example.php:1.15 pear/XML_Util/examples/example.php:1.16 --- pear/XML_Util/examples/example.php:1.15 Sun May 4 23:35:05 2008 +++ pear/XML_Util/examples/example.php Mon May 5 19:03:13 2008 @@ -44,7 +44,7 @@ * @author Stephan Schmidt <[email protected]> * @copyright 2003-2008 Stephan Schmidt <[email protected]> * @license http://opensource.org/licenses/bsd-license New BSD License - * @version CVS: $Id: example.php,v 1.15 2008/05/04 23:35:05 ashnazg Exp $ + * @version CVS: $Id: example.php,v 1.16 2008/05/05 19:03:13 ashnazg Exp $ * @link http://pear.php.net/package/XML_Util */ @@ -58,59 +58,59 @@ /** * replacing XML entities */ - print "replace XML entities:<br>\n"; - print XML_Util::replaceEntities("This string contains < & >."); + print 'replace XML entities:<br>'; + print XML_Util::replaceEntities('This string contains < & >.'); print "\n<br><br>\n"; /** * reversing XML entities */ - print "replace XML entities:<br>\n"; - print XML_Util::reverseEntities("This string contains < & >."); + print 'replace XML entities:<br>'; + print XML_Util::reverseEntities('This string contains < & >.'); print "\n<br><br>\n"; /** * building XML declaration */ - print "building XML declaration:<br>\n"; + print 'building XML declaration:<br>'; print htmlspecialchars(XML_Util::getXMLDeclaration()); print "\n<br><br>\n"; - print "building XML declaration with additional attributes:<br>"; - print htmlspecialchars(XML_Util::getXMLDeclaration("1.0", "UTF-8", true)); + print 'building XML declaration with additional attributes:<br>'; + print htmlspecialchars(XML_Util::getXMLDeclaration('1.0', 'UTF-8', true)); print "\n<br><br>\n"; /** * building document type declaration */ - print "building DocType declaration:<br>\n"; + print 'building DocType declaration:<br>'; print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 'http://pear.php.net/dtd/package-1.0')); print "\n<br><br>\n"; - print "building DocType declaration with public ID (does not exist):<br>\n"; + print 'building DocType declaration with public ID (does not exist):<br>'; 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<br><br>\n"; - print "building DocType declaration with internal DTD:<br>\n"; - print "<pre>"; + print 'building DocType declaration with internal DTD:<br>'; + print '<pre>'; print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 'http://pear.php.net/dtd/package-1.0', '<!ELEMENT additionalInfo (#PCDATA)>')); - print "</pre>"; + print '</pre>'; print "\n<br><br>\n"; /** * creating an attribute string */ $att = array( - "foo" => "bar", - "argh" => "tomato" + 'foo' => 'bar', + 'argh' => 'tomato' ); - print "converting array to string:<br>\n"; + print 'converting array to string:<br>'; print XML_Util::attributesToString($att); print "\n<br><br>\n"; @@ -119,72 +119,72 @@ * creating an attribute string with linebreaks */ $att = array( - "foo" => "bar", - "argh" => "tomato" + 'foo' => 'bar', + 'argh' => 'tomato' ); - print "converting array to string (including line breaks):<br>\n"; - print "<pre>"; + print 'converting array to string (including line breaks):<br>'; + print '<pre>'; print XML_Util::attributesToString($att, true, true); - print "</pre>"; + print '</pre>'; print "\n<br><br>\n"; /** * splitting a qualified tag name */ - print "splitting qualified tag name:<br>\n"; - print "<pre>"; - print_r(XML_Util::splitQualifiedName("xslt:stylesheet")); - print "</pre>"; + print 'splitting qualified tag name:<br>'; + print '<pre>'; + print_r(XML_Util::splitQualifiedName('xslt:stylesheet')); + print '</pre>'; print "\n<br>\n"; /** * splitting a qualified tag name (no namespace) */ - print "splitting qualified tag name (no namespace):<br>\n"; - print "<pre>"; - print_r(XML_Util::splitQualifiedName("foo")); - print "</pre>"; + print 'splitting qualified tag name (no namespace):<br>'; + print '<pre>'; + print_r(XML_Util::splitQualifiedName('foo')); + print '</pre>'; print "\n<br>\n"; /** * splitting a qualified tag name (no namespace, but default namespace specified) */ - print "splitting qualified tag name " - . "(no namespace, but default namespace specified):<br>\n"; - print "<pre>"; - print_r(XML_Util::splitQualifiedName("foo", "bar")); - print "</pre>"; + print 'splitting qualified tag name ' + . '(no namespace, but default namespace specified):<br>'; + print '<pre>'; + print_r(XML_Util::splitQualifiedName('foo', 'bar')); + print '</pre>'; print "\n<br>\n"; /** * verifying XML names */ - print "verifying 'My private tag':<br>\n"; - print "<pre>"; + print 'verifying \'My private tag\':<br>'; + print '<pre>'; print_r(XML_Util::isValidname('My Private Tag')); - print "</pre>"; + print '</pre>'; print "\n<br><br>\n"; - print "verifying '-MyTag':<br>\n"; - print "<pre>"; + print 'verifying \'-MyTag\':<br>'; + print '<pre>'; print_r(XML_Util::isValidname('-MyTag')); - print "</pre>"; + print '</pre>'; print "\n<br><br>\n"; /** * creating an XML tag */ $tag = array( - "namespace" => "foo", - "localPart" => "bar", - "attributes" => array("key" => "value", "argh" => "fruit&vegetable"), - "content" => "I'm inside the tag" + '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:<br>"; + print 'creating a tag with namespace and local part:<br>'; print htmlentities(XML_Util::createTagFromArray($tag)); print "\n<br><br>\n"; @@ -192,13 +192,13 @@ * 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" + '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:<br>\n"; + print 'creating a tag with qualified name and namespaceUri:<br>'; print htmlentities(XML_Util::createTagFromArray($tag)); print "\n<br><br>\n"; @@ -206,12 +206,12 @@ * creating an XML tag */ $tag = array( - "qname" => "bar", - "namespaceUri" => "http://foo.com", - "attributes" => array("key" => "value", "argh" => "fruit&vegetable") + 'qname' => 'bar', + 'namespaceUri' => 'http://foo.com', + 'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable') ); - print "creating an empty tag without namespace but namespace Uri:<br>\n"; + print 'creating an empty tag without namespace but namespace Uri:<br>'; print htmlentities(XML_Util::createTagFromArray($tag)); print "\n<br><br>\n"; @@ -219,17 +219,17 @@ * creating an XML tag with more namespaces */ $tag = array( - "namespace" => "foo", - "localPart" => "bar", - "attributes" => array("key" => "value", "argh" => "fruit&vegetable"), - "content" => "I'm inside the tag", - "namespaces" => array( - "bar" => "http://bar.com", - "pear" => "http://pear.php.net", + 'namespace' => 'foo', + 'localPart' => 'bar', + 'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'), + 'content' => 'I\'m inside the tag', + 'namespaces' => array( + 'bar' => 'http://bar.com', + 'pear' => 'http://pear.php.net', ) ); - print "creating an XML tag with more namespaces:<br />"; + print 'creating an XML tag with more namespaces:<br />'; print htmlentities(XML_Util::createTagFromArray($tag)); print "\n<br><br>\n"; @@ -237,12 +237,12 @@ * 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" + 'qname' => 'foo', + 'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'), + 'content' => 'I\'m inside the tag' ); - print "creating a tag with CData section:<br>\n"; + print 'creating a tag with CData section:<br>'; print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_CDATA_SECTION)); print "\n<br><br>\n"; @@ -257,18 +257,18 @@ . "and HTML entities can be replaced Ä ä Ü ö <>." ); - print "creating a tag with HTML entities:<br>\n"; + print 'creating a tag with HTML entities:<br>'; print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_ENTITIES_HTML)); print "\n<br><br>\n"; /** * creating an XML tag with createTag */ - print "creating a tag with createTag:<br>"; - print htmlentities(XML_Util::createTag("myNs:myTag", - array("foo" => "bar"), - "This is inside the tag", - "http://www.w3c.org/myNs#")); + print 'creating a tag with createTag:<br>'; + print htmlentities(XML_Util::createTag('myNs:myTag', + array('foo' => 'bar'), + 'This is inside the tag', + 'http://www.w3c.org/myNs#')); print "\n<br><br>\n"; @@ -276,24 +276,24 @@ * trying to create an XML tag with an array as content */ $tag = array( - "qname" => "bar", - "content" => array("foo" => "bar") + 'qname' => 'bar', + 'content' => array('foo' => 'bar') ); - print "trying to create an XML tag with an array as content:<br>\n"; - print "<pre>"; + print 'trying to create an XML tag with an array as content:<br>'; + print '<pre>'; print_r(XML_Util::createTagFromArray($tag)); - print "</pre>"; + print '</pre>'; print "\n<br><br>\n"; /** * trying to create an XML tag without a name */ $tag = array( - "attributes" => array("foo" => "bar"), + 'attributes' => array('foo' => 'bar'), ); - print "trying to create an XML tag without a name:<br>\n"; - print "<pre>"; + print 'trying to create an XML tag without a name:<br>'; + print '<pre>'; print_r(XML_Util::createTagFromArray($tag)); - print "</pre>"; + print '</pre>'; print "\n<br><br>\n"; ?>