On 25 March 2011 15:42, Richard Quadling <rquadling@xxxxxxxxx> wrote: > On 25 March 2011 14:16, Hosh <hosh_90@xxxxxxxx> wrote: >> I have a piece of code that extracts .p3t files (sample file can be found >> here: http://download.ps3-themes.com/downloads3/11518-MyFirstTheme.p3t ). >> It uses PHPs unpack() function. The complete script can be found at: >> http://pastebin.com/bRGL9KFh . However I am getting this error: >> >> Warning: DOMElement::setAttribute() [domelement.setattribute]: Couldn't >> fetch P3TElement in D:\www\p3textract\extract.php on line 115 >> >> I have no idea what this means and I have asked on multiple boards for >> help, no one seems to know the answer. >> >> Any help regarding this would be welcome. >> >> Regards, >> >> Hosh >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > I assume you saw http://www.ps3-themes.com/theme-extractor > > You've been busy asking this question (the first 3 links I found were > to your question!). > > I'm not an expert on DOM, but http://bugs.php.net/bug.php?id=39593 may > be the issue. > > I don't think you are creating a real DOM, just an element. I think. > > I'd suggest, creating the DOMDocument first and then add the elements > as they are created, and then add the attributes. > > > > > -- > Richard Quadling > Twitter : EE : Zend > @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY > http://uk2.php.net/manual/en/domelement.construct.php "Creates a new DOMElement object. This object is read only. It may be appended to a document, but additional nodes may not be appended to this node until the node is associated with a document. To create a writeable node, use DOMDocument::createElement or DOMDocument::createElementNS." <?php $ele = new DOMElement('AboutToFail'); $ele->setAttribute('Not', 'working'); ?> outputs ... PHP Fatal error: Uncaught exception 'DOMException' with message 'No Modification Allowed Error' in -:3 Stack trace: #0 -(3): DOMElement->setAttribute('Not', 'working') #1 {main} thrown in - on line 3 Fatal error: Uncaught exception 'DOMException' with message 'No Modification Allowed Error' in -:3 Stack trace: #0 -(3): DOMElement->setAttribute('Not', 'working') #1 {main} thrown in - on line 3 But ... <?php $doc = new DOMDocument; $doc->appendChild($ele = $doc->createElement('GoingToWork')); $ele->setAttribute('It', 'works'); echo $doc->saveXML(); ?> outputs ... <?xml version="1.0"?> <GoingToWork It="works"/> -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php