cvs: pear /XML_Beautifier Beautifier.php package.php /XML_Beautifier/examples test2.xml
| From: | Stephan Schmidt | Date: | Mon, 29 Sep 2003 21:29:22 +0000 |
| Subject: | cvs: pear /XML_Beautifier Beautifier.php package.php /XML_Beautifier/examples test2.xml | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-13178@lists.php.net to get a copy of this message | ||
schst Mon Sep 29 17:29:22 2003 EDT
Removed files:
/pear/XML_Beautifier package.php
Modified files:
/pear/XML_Beautifier Beautifier.php
/pear/XML_Beautifier/examples test2.xml
Log:
added support for XML declaration
Index: pear/XML_Beautifier/Beautifier.php
diff -u pear/XML_Beautifier/Beautifier.php:1.1.1.1 pear/XML_Beautifier/Beautifier.php:1.2
--- pear/XML_Beautifier/Beautifier.php:1.1.1.1 Mon Sep 29 16:00:52 2003
+++ pear/XML_Beautifier/Beautifier.php Mon Sep 29 17:29:21 2003
@@ -353,8 +353,7 @@
*/
case XML_BEAUTIFIER_XML_DECLARATION:
$indent = $this->_getIndentString($struct["depth"]);
- $xml = $indent . XML_Util::getXMLDeclaration();
-
+ $xml = $indent . XML_Util::getXMLDeclaration($struct["version"],
$struct["encoding"], $struct["standalone"]);
break;
/*
@@ -599,10 +598,22 @@
$attribs[$match[1][$i]] = $match[2][$i];
}
+ if (!isset($attribs["version"])) {
+ $attribs["version"] = "1.0";
+ }
+ if (!isset($attribs["encoding"])) {
+ $attribs["encoding"] = "UTF-8";
+ }
+ if (!isset($attribs["standalone"])) {
+ $attribs["standalone"] = true;
+ }
+
$struct = array(
- "type" => XML_BEAUTIFIER_XML_DECLARATION,
- "attribs" => $attribs,
- "depth" => $this->_depth
+ "type" => XML_BEAUTIFIER_XML_DECLARATION,
+ "version" => $attribs["version"],
+ "encoding" => $attribs["encoding"],
+ "standalone" => $attribs["standalone"],
+ "depth" => $this->_depth
);
} else {
/*
Index: pear/XML_Beautifier/examples/test2.xml
diff -u pear/XML_Beautifier/examples/test2.xml:1.1.1.1 pear/XML_Beautifier/examples/test2.xml:1.2
--- pear/XML_Beautifier/examples/test2.xml:1.1.1.1 Mon Sep 29 16:00:53 2003
+++ pear/XML_Beautifier/examples/test2.xml Mon Sep 29 17:29:22 2003
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<!DOCTYPE page [
<!ENTITY foo SYSTEM "foo.xml">
<!ENTITY bar SYSTEM "bar.xml">