anewt-developers team mailing list archive
-
anewt-developers team
-
Mailing list archive
-
Message #00125
[Branch ~uws/anewt/anewt.uws] Rev 1720: [xml/writer] Minor cleanups and documentation fixes
------------------------------------------------------------
revno: 1720
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Sun 2009-08-02 19:04:58 +0200
message:
[xml/writer] Minor cleanups and documentation fixes
modified:
xml/writer.lib.php
--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws
Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.
=== modified file 'xml/writer.lib.php'
--- xml/writer.lib.php 2008-10-26 21:36:08 +0000
+++ xml/writer.lib.php 2009-08-02 17:04:58 +0000
@@ -22,9 +22,9 @@
* - Set some properties on the AnewtXMLWriter instance
* - Start the document using AnewtXMLWriter::write_start_document()
* - Write out the elements, attributes and textual content using the various
- * methods provided for that, e.g.AnewtXMLWriter::write_start_element() and
- * AnewtXMLWriter::write_attribute
- * - End the document using AnewtXMLWriter::write_start_document()
+ * methods provided for that, e.g. AnewtXMLWriter::write_start_element() and
+ * AnewtXMLWriter::write_attribute()
+ * - End the document using AnewtXMLWriter::write_end_document()
* - Render or flush the output using AnewtXMLWriter::render() or
* AnewtXMLWriter::flush()
*
@@ -143,7 +143,7 @@
}
/**
- * Return a reference to the current document.
+ * Return the AnewtXMLDomDocument instance this AnewtXMLWriter uses.
*
* This method can be used to retrieve the generated document. This method
* is only supposed to be called after a call to
@@ -154,7 +154,7 @@
* \return
* An AnewtXMLDomDocument instance.
*/
- public function &get_document()
+ public function get_document()
{
return $this->_document;
}
@@ -183,18 +183,18 @@
{
assert('!is_null($this->_document); // no document has been started');
- $new_element = &$this->_document->create_element($name, $attributes);
+ $new_element = $this->_document->create_element($name, $attributes);
if (is_null($this->_current_element))
{
$this->_document->append_child($new_element);
- $this->_current_element = &$new_element;
+ $this->_current_element = $new_element;
}
else
{
$this->_current_element->append_child($new_element);
unset ($this->_current_element);
- $this->_current_element = &$new_element;
+ $this->_current_element = $new_element;
}
}
@@ -221,9 +221,9 @@
assert('$this->_current_element->node_name == $name; // element name mismatch');
}
- $parent_node = &$this->_current_element->parent_node;
+ $parent_node = $this->_current_element->parent_node;
unset ($this->_current_element);
- $this->_current_element = &$parent_node;
+ $this->_current_element = $parent_node;
}
/**
@@ -322,9 +322,11 @@
*/
public function write_attributes($attributes)
{
+ assert('!is_null($this->_document); // no document has been started');
+ assert('!is_null($this->_current_element); // no current element');
+ assert('$this->_current_element instanceof AnewtXMLDomElement; // no valid element open');
assert('is_assoc_array($attributes)');
- foreach ($attributes as $name => $value)
- $this->_current_element->set_attribute($name, $value);
+ $this->_current_element->set_attributes($attributes);
}
/** \} */