Based on what learned from my readings on web and forums, I'll go for DOM with DOMDocument.

"SAX is better for memory efficiency but a bit complex and chalenging."
"DOM is uses loads whole xml into memory but easier and widely prefered and used."

The question is, based on your experiences, what should be the max size of the xml file that I'll use or max lines? Since whole file will be loaded into memory and my site is being hosted on one of those online hosting companies.

Any other suggestions are more welcomed.

Thanks in advance

Recommended Answers

All 2 Replies

The max size of your file should be determined by your bandwidth. If your pages are loading slowly, then you know you should decress your file size. If they are loading quickly then make no changes.

One question. XML files will be hosted on external site and my script is going to read the content over http link. e.g.

$xml_content = read_with_sax_or_dom('h-t-t-p://w-w-w.hebedehubede.c-o-m/xmlfile.x-m-l');

In this case what approach would be the best to save system resources since my site is running on shared hosting company. I don't mind using SAX or DOM if one has very good advantages over another.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.