Page 1 of 1
PHP DOM
Posted: Thu Apr 03, 2003 4:35 am
by d1223m
has anyone written anything to save back from php objects?
the manual describes functions to read it in but say this is to be considered read only.
if not has anyone ideas on creating such a thing?
Re: PHP DOM
Posted: Thu Apr 03, 2003 8:16 am
by BDKR
d1223m wrote:
the manual describes functions to read it in but say this is to be considered read only.
Which part of the manual is it that says this? Based on the description of the unserialize function, it's possible to overcome possible issues relating to unserializing objects with the help of the unserialize_callback_func directive.
Check out these links for more data.
http://www.php.net/manual/en/function.unserialize.php
http://www.php.net/manual/en/language.o ... zation.php
This link here may be of some help as well.
http://www.webkreator.com/php/configura ... ading.html
Do some reading and experimenting. You'll get it!
Cheers,
BDKR
Posted: Thu Apr 03, 2003 8:17 am
by Stoker
since PHP4 doesnt offer any object protection or strict-to-class-def stuff you can generate all variables from the outside...
Posted: Thu Apr 03, 2003 8:31 am
by d1223m
stoker i dont understand what you mean
Posted: Thu Apr 03, 2003 8:37 am
by d1223m
BDKR:
the "read-only" thing i was talking about is from
http://www.php.net/manual/en/ref.domxml.php
The extension allows you to operate on an XML document with the DOM API. It also provides a function domxml_xmltree() to turn the complete XML document into a tree of PHP objects. Currently, this tree should be considered read-only — you can modify it, but this would not make any sense since DomDocument_dump_mem() cannot be applied to it. Therefore, if you want to read an XML file and write a modified version, use DomDocument_create_element()
Im looking for opposite to xmltree, ie to turn a object tree into an xml file [/quote]
Posted: Thu Apr 03, 2003 8:48 am
by Stoker
ah sorry, I think we both missunderstood, sort of forgot about the subject and was thinkiong of PHP-objects only
hmm yes you are right, PHP-DOM is not superuseful, I did one project ones that would run thru each element and write them on the fly, but was fairly ineffecient, might as well just use arrays instead of DOM..
Posted: Thu Apr 03, 2003 8:51 am
by Stoker
BTW, if you don't need it converted back to DOM, you just need the object tree stored you can use serialize for that... and unserialize for reading it back (from file, database or http-post etc).
Posted: Thu Apr 03, 2003 8:52 am
by d1223m
lol - thats what BDKR said
Posted: Fri Apr 04, 2003 9:34 am
by BDKR
d1223m wrote:lol - thats what BDKR said
Well, one way or the other, it seems that I mis-understood the original post.
Hope you get if figured though.
Cheers,
BDKR
Posted: Sun Apr 06, 2003 5:30 am
by d1223m
ive been having fun looking thru the pear manual today.
here is pretty much what i wanted :
http://pear.php.net/manual/en/packages.xml.xml_tree.php