First of all, if you have the option to upgrade you might want to check out PHP5. SimpleXML really makes it easy to parse xml files. If PHP4 is your platform of choice, check out PEAR's XML_Parser package.

The entities can't be handle with xml_set_default_handler because some entities are inside an attribute (title, href) and are then printed before the tag. How can I fix this?

In order to parse xml attributes you should use xml_set_element_handler. http://www.php.net/manual/en/function.xml-set-element-handler.php


I don't understand how those other functions work: http://www.php.net/manual/en/function.xml-set-external-entity-ref-handler.php http://www.php.net/manual/en/function.xml-set-unparsed-entity-decl-handler.php

Haven't used these, maybe others can help?


Could it be the solution?

Another problem is that it changes tags like <img /> by <img></img>.
Is there a way to avoid this?

With xml_set_element_handler you tell the parser to use callback functions for your start tag / end tag. You can set up your callback functions to handle img tags special.




+ Cheers

(PS - I am also curious about how the fuction xml_set_start_namespace_decl_handler() work.
Does someone know some informations about?)

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to