Skip to content

Commit

Permalink
Issue #81: Pretty-printing XML/HTML is default.
Browse files Browse the repository at this point in the history
By default, output is now formatted, and there is an option
to disable.
  • Loading branch information
technosophos committed May 25, 2012
1 parent ae4ab24 commit 06f31fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/QueryPath/DOMQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ public function __construct($document = NULL, $string = NULL, $options = array()
$this->setMatches($this->document->documentElement);
}

// Globally set the output option.
if (isset($this->options['format_output']) && $this->options['format_output'] == FALSE) {
$this->document->formatOutput = FALSE;
}
else {
$this->document->formatOutput = TRUE;
}

// Do a find if the second param was set.
if (isset($string) && strlen($string) > 0) {
$this->find($string);
Expand Down
4 changes: 4 additions & 0 deletions src/qp.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
* - omit_xml_declaration: Boolean. If this is TRUE, then certain output
* methods (like {@link QueryPath::xml()}) will omit the XML declaration
* from the beginning of a document.
* - format_output: Boolean. If this is set to TRUE, QueryPath will format
* the HTML or XML output to make it more readible. If this is set to
* FALSE, QueryPath will minimize whitespace to keep the document smaller
* but harder to read.
* - replace_entities: Boolean. If this is TRUE, then any of the insertion
* functions (before(), append(), etc.) will replace named entities with
* their decimal equivalent, and will replace un-escaped ampersands with
Expand Down

0 comments on commit 06f31fb

Please sign in to comment.