[PEPr] Comment on Web Services::Services_Yadis
| From: | Christian Schmidt | Date: | Fri, 13 Jul 2007 15:52:52 +0000 |
| Subject: | [PEPr] Comment on Web Services::Services_Yadis | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-47471@lists.php.net to get a copy of this message | ||
Christian Schmidt (http://pear.php.net/user/schmidt) has commented on the proposal for Web
Services::Services_Yadis.
Comment:
Just a few follow-up comments:
>I suggest using DOMDocument::loadHTML() in _isMetaHttpEquiv()
Cool. Shouldn't the http-equiv attribute values be treated as
case-insensitive?
>I did some small changes in the Namespace object to refer to
$namespaceKey.
Fine - though this is usually called "prefix".
>I've added a method to Services_Yadis_Service to allow the export
>of a DOMDocument
Nice. Instead of creating a whole new document, you can simply return a
DOMElement like you do with SimpleXML using
dom_import_simplexml($this->serviceNode). Perhaps getDomElement() is a
better name to avoid confusion with the other classes in DOM API.
> The schema makes exclusive use of the "xrd" titled namespace
An XML document isn't required to use the same prefixes as in the XML
document. This is an example of a document that validates against the
schemas mentioned in the Yadis spec (at least with the validator, I used).
<?xml version="1.0" encoding="UTF-8"?>
<bar:XRDS
xmlns:bar="xri://$xrds"
xmlns:foo="xri://$xrd*($v*2.0)">
<foo:XRD>
<foo:Service>
<foo:Type>http://lid.netmesh.org/sso/2.0</foo:Type>
</foo:Service>
</foo:XRD>
</bar:XRDS>
>>In Services_Yadis::__construct() it is explicitly checked that the
>>second argument is an array. Is this necessary
>[...] it seems like a good idea to return them an early error about
>what parameter type is expected.
My point is that PHP does this automatically. If you supply anything else,
PHP will trigger an error, e.g. "Catchable fatal error: Argument 1 passed
to Services_Yadis::__construct() must be an array, integer given", and the
exception will never be thrown (unless I missed something).
In Services_Yadis_Xrds_Namespace::addNamespace(), I think in_array()
should be replaced with array_key_exists().
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=499
--
Sent by PEPr, the automatic proposal system at http://pear.php.net