1 : <?php
2 : /**
3 : * Load FluentDOM from SimpleXMLElement
4 : *
5 : * @version $Id: SimpleXMLElement.php 431 2010-03-29 20:42:04Z subjective $
6 : * @license http://www.opensource.org/licenses/mit-license.php The MIT License
7 : * @copyright Copyright (c) 2009 Bastian Feder, Thomas Weinert
8 : *
9 : * @package FluentDOM
10 : * @subpackage Loaders
11 : */
12 :
13 : /**
14 : * include interface
15 : */
16 : require_once(dirname(__FILE__).'/../Loader.php');
17 :
18 : /**
19 : * Load FluentDOM from SimpleXMLElement
20 : *
21 : * @package FluentDOM
22 : * @subpackage Loaders
23 : */
24 : class FluentDOMLoaderSimpleXMLElement implements FluentDOMLoader {
25 :
26 : /**
27 : * Select DOMNode representation of an existing SimpleXMLElement
28 : *
29 : * @param SimpleXMLElement $source
30 : * @param string $contentType
31 : * @return array(DOMDocument,DOMNode)|FALSE
32 : */
33 : public function load($source, $contentType) {
34 2 : if ($source instanceof SimpleXMLElement) {
35 1 : $node = dom_import_simplexml($source);
36 1 : return array($node->ownerDocument, array($node));
37 : }
38 1 : return FALSE;
39 : }
40 : }
41 :
|