added namespace awareness to xmlobj->hasSub and ->sub

added addXPathHandler to XMLStream
fixed a few typos in comments
added myself to @author


git-svn-id: svn://netflint.net/xmpphp@61 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
gar
2008-11-11 09:56:16 +00:00
parent 4ee8bc30d9
commit 6860070b7e
2 changed files with 57 additions and 7 deletions

View File

@@ -22,6 +22,7 @@
* @package XMPPHP
* @author Nathanael C. Fritz <JID: fritzy@netflint.net>
* @author Stephan Wentz <JID: stephan@jabber.wentz.it>
* @author Michael Garvin <JID: gar@netflint.net>
* @copyright 2008 Nathanael C. Fritz
*/
@@ -131,9 +132,9 @@ class XMPPHP_XMLObj {
* @param string $name
* @return boolean
*/
public function hasSub($name) {
public function hasSub($name, $ns = null) {
foreach($this->subs as $sub) {
if($sub->name == $name) return true;
if(($name == "*" or $sub->name == $name) and ($ns == null or $sub->ns == $ns)) return true;
}
return false;
}
@@ -146,8 +147,9 @@ class XMPPHP_XMLObj {
* @param string $ns
*/
public function sub($name, $attrs = null, $ns = null) {
#TODO attrs is ignored
foreach($this->subs as $sub) {
if($sub->name == $name) {
if($sub->name == $name and ($ns == null or $sub->ns == $ns)) {
return $sub;
}
}