1 | <?php |
||
19 | abstract class XmlAbstract extends StandardAbstract |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Name of the node containing all the feed's items |
||
24 | */ |
||
25 | const ITEM_NODE = 'item'; |
||
26 | |||
27 | /** |
||
28 | * This is for XML Standards |
||
29 | */ |
||
30 | const SYNTAX_FORMAT = 'Xml'; |
||
31 | |||
32 | /** |
||
33 | * RuleSet used to parse the feed's main node |
||
34 | * @var \FeedIo\RuleSet |
||
35 | */ |
||
36 | protected $feedRuleSet; |
||
37 | |||
38 | /** |
||
39 | * @var \FeedIo\RuleSet |
||
40 | */ |
||
41 | protected $itemRuleSet; |
||
42 | |||
43 | /** |
||
44 | * Formats the document according to the standard's specification |
||
45 | * @param \DOMDocument $document |
||
46 | * @return mixed |
||
47 | */ |
||
48 | abstract public function format(\DOMDocument $document); |
||
49 | |||
50 | /** |
||
51 | * @param \DOMDocument $document |
||
52 | * @return \DomElement |
||
53 | */ |
||
54 | abstract public function getMainElement(\DOMDocument $document); |
||
55 | |||
56 | /** |
||
57 | * Builds and returns a rule set to parse the root node |
||
58 | * @return \FeedIo\RuleSet |
||
59 | */ |
||
60 | abstract public function buildFeedRuleSet(); |
||
61 | |||
62 | /** |
||
63 | * Builds and returns a rule set to parse an item |
||
64 | * @return \FeedIo\RuleSet |
||
65 | */ |
||
66 | abstract public function buildItemRuleSet(); |
||
67 | |||
68 | /** |
||
69 | * @return string |
||
70 | */ |
||
71 | 13 | public function getItemNodeName() |
|
75 | |||
76 | /** |
||
77 | * @return XmlFormatter |
||
78 | */ |
||
79 | public function getFormatter() |
||
83 | |||
84 | /** |
||
85 | * Returns the RuleSet used to parse the feed's main node |
||
86 | * @return \FeedIo\RuleSet |
||
87 | */ |
||
88 | 14 | public function getFeedRuleSet() |
|
89 | { |
||
90 | 14 | if (is_null($this->feedRuleSet)) { |
|
91 | 14 | $this->feedRuleSet = $this->buildFeedRuleSet(); |
|
92 | 14 | } |
|
93 | |||
94 | 14 | return $this->feedRuleSet; |
|
95 | } |
||
96 | |||
97 | /** |
||
98 | * @return \FeedIo\RuleSet |
||
99 | */ |
||
100 | 12 | public function getItemRuleSet() |
|
108 | |||
109 | /** |
||
110 | * @param string $tagName |
||
111 | * @return ModifiedSince |
||
112 | */ |
||
113 | 16 | public function getModifiedSinceRule($tagName) |
|
121 | |||
122 | /** |
||
123 | * @return RuleSet |
||
124 | */ |
||
125 | 16 | protected function buildBaseRuleSet() |
|
132 | } |
||
133 |