15 private $ODDSupportedVersion =
"1.0";
25 private $wrapperfactory;
36 if (is_array($elements)) {
37 $this->elements = $elements;
42 $this->elements = array();
52 return $this->ODDSupportedVersion;
61 return count($this->elements);
72 if (!is_array($this->elements)) {
73 $this->elements = array();
75 $this->elements[] = $element;
86 foreach ($elements as $element) {
97 return $this->elements;
108 $this->wrapperfactory = $factory;
119 if ($this->wrapperfactory) {
121 $wrapper = $this->wrapperfactory->getElementWrapper($this);
123 $xml = $wrapper->wrap($this);
126 $generated = date(
"r");
127 $xml .=
"<odd version=\"{$this->ODDSupportedVersion}\" generated=\"$generated\">\n";
130 foreach ($this->elements as $element) {
147 private $valid =
false;
157 $this->
valid = (
false !== reset($this->elements));
168 return current($this->elements);
179 return key($this->elements);
190 $this->
valid = (
false !==
next($this->elements));
getNumElements()
Returns the number of elements.
valid()
Iterator interface.
__toString()
Magic function to generate valid ODD XML for this item.
addElement(ODD $element)
Add an element.
setWrapperFactory(ODDWrapperFactory $factory)
Set an optional wrapper factory to optionally embed the ODD document in another format.
getElements()
Return all elements.
current()
Iterator interface.
next()
Iterator interface.
__construct(array $elements=null)
Create a new ODD Document.
addElements(array $elements)
Add multiple elements at once.
getVersion()
Return the version of ODD being used.
rewind()
Iterator interface.