Jump to content

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?
Link to comment
https://forums.phpfreaks.com/topic/10055-solved-extend-domdocument/
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)
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.