Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Inject a DOMDocument

  • Loading branch information...
commit b6ab358677385b00afcf3d84fd592cee63b154b3 1 parent b0640b5
@CloCkWeRX CloCkWeRX authored
Showing with 5 additions and 5 deletions.
  1. +1 −1  XML/Feed/Parser.php
  2. +4 −4 XML/Feed/Parser/Factory.php
View
2  XML/Feed/Parser.php
@@ -114,7 +114,7 @@ function __construct($feed, $strict = false, $suppressWarnings = false, $tidy =
function initialize($feed, $strict = false, $suppressWarnings = false, $tidy = false)
{
$factory = new XML_Feed_Parser_Factory();
- $this->feed = $factory->build($feed);
+ $this->feed = $factory->build($this->model, $feed, $strict = false, $suppressWarnings = false, $tidy = false);
}
View
8 XML/Feed/Parser/Factory.php
@@ -14,15 +14,15 @@ class XML_Feed_Parser_Factory {
* @param bool $suppressWarnings Trigger errors for deprecated feed types?
* @param bool $tidy Whether or not to try and use the tidy library on input
*/
- function build($feed, $strict = false, $suppressWarnings = false, $tidy = false)
+ function build(DOMDocument $model, $feed, $strict = false, $suppressWarnings = false, $tidy = false)
{
- if (! $feed->model->loadXML($feed, $options)) {
+ if (! $model->loadXML($feed, $options)) {
if (extension_loaded('tidy') && $tidy) {
$tidy = new tidy;
$tidy->parseString($feed,
array('input-xml' => true, 'output-xml' => true));
$tidy->cleanRepair();
- if (! $feed->model->loadXML((string) $tidy)) {
+ if (! $model->loadXML((string) $tidy)) {
throw new XML_Feed_Parser_Exception('Invalid input: this is not ' .
'valid XML');
}
@@ -33,7 +33,7 @@ function build($feed, $strict = false, $suppressWarnings = false, $tidy = false)
/* detect feed type */
- $doc_element = $feed->model->documentElement;
+ $doc_element = $model->documentElement;
$class = $this->determineClass($doc_element, $suppressWarnings);
Please sign in to comment.
Something went wrong with that request. Please try again.