Jump to content

Archived

This topic is now archived and is closed to further replies.

448191

**SOLVED** Extend DOMDocument

Recommended Posts

Hey guys, I can't get this to work:

[code]class simpleXML extends DOMDocument
{
    private $filePath;
    
    function __construct($file)
    {
        parent::__construct();
        if(file_exists($file)){
            parent::load($file);
        }
            else {    //Create root element:
            $root = parent::createElement(substr($file,strrpos($file,'/' )+1,strlen($file)));
            parent::appendChild($root);
        }
        $this->filePath = $file;
        $this->preserveWhitespace = false;    
        $this->formatOutput = true;
    }
    function __destruct()
    {
        parent::save($this->filePath);        
    }
}[/code]

It just puts the endtag, no starting tag... [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
Maybe DOMDocument just wasn't meant to be extended?

Share this post


Link to post
Share on other sites
Looks fine to me. I get

[code]<?xml version="1.0"?>
<afilename/>[/code]

If it were an end tag it would be

[code]</afilename>[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=375473:date=May 20 2006, 04:33 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ May 20 2006, 04:33 AM) [snapback]375473[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Looks fine to me. I get

[code]<?xml version="1.0"?>
<afilename/>[/code]

If it were an end tag it would be

[code]</afilename>[/code]
[/quote]

Whahahaha.... [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] That's so "me"... I could've sworn it said '</file>'!

Thanks! (and I apologize for not paying attention)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.