Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16243 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99852 invoked by uid 1010); 13 May 2005 21:59:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 67305 invoked from network); 13 May 2005 21:28:46 -0000 Received: from unknown (HELO bol.com.br) (127.0.0.1) by localhost with SMTP; 13 May 2005 21:28:46 -0000 X-Host-Fingerprint: 212.250.162.15 smtpout15.mailhost.ntl.com Solaris 8 (1) Received: from ([212.250.162.15:32167] helo=mta05-winn.mailhost.ntl.com) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 03/98-36148-A0C15824 for ; Fri, 13 May 2005 17:28:44 -0400 Received: from aamta04-winn.mailhost.ntl.com ([212.250.162.8]) by mta05-winn.mailhost.ntl.com with ESMTP id <20050513212830.WTAG8060.mta05-winn.mailhost.ntl.com@aamta04-winn.mailhost.ntl.com>; Fri, 13 May 2005 22:28:30 +0100 Received: from win2ks ([213.107.8.99]) by aamta04-winn.mailhost.ntl.com with ESMTP id <20050513212830.VPWD1352.aamta04-winn.mailhost.ntl.com@win2ks>; Fri, 13 May 2005 22:28:30 +0100 Reply-To: To: "'George Schlossnagle'" , "'PHPdev List'" Date: Fri, 13 May 2005 22:29:59 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 In-Reply-To: <4FFCA3A4-8367-432F-A665-391F804F6C8A@omniti.com> Thread-index: AcVYAETzPqIPA256QeONSsUNX7cH4QAAYT0g Message-ID: <20050513212830.VPWD1352.aamta04-winn.mailhost.ntl.com@win2ks> Subject: RE: [PHP-DEV] annoying DOM limitation From: jared.williams1@ntlworld.com ("Jared Williams") References: <4FFCA3A4-8367-432F-A665-391F804F6C8A@omniti.com> > > While hacking on a PHPDoc -> WSDL generator, I ran into an > annoying limitation in the dom extension: you can't add a > namespace to a dom document unless you have an element in > that namespace. Why might you want to do this? Well, a > common thing is to have your xml-schema types to be specified > as attribute values, i.e. > > > > for this to work I need xsd to be an alias for > http://www.w3.org/2001/ XMLSchema. > > To work around this, I added a DomElement::addNS($uri, > $alias) method to Dom. Adding the namespace 'manually' as an > attribute on an element does not work. > > I know this isn't part of the Dom spec, but it's incredibly useful. > Does anyone (Rob, Chegru) mind me adding it to HEAD? Hmm, I have been doing this via setAttributeNS(), with the XML namespace namepace define('NS_NS', 'http://www.w3.org/2000/xmlns/'); define('NS_XLINK', 'http://www.w3.org/1999/xlink'); $document = new DOMDocument(); $root = $document->createElement('root'); $document->appendChild($root); $root->setAttributeNS(NS_NS, 'xmlns:xlink', NS_XLINK); echo $document->saveXML(); Haven't encountered any problems with this method, seems to produce XML (SVG in this case) fine. Jared