The xml parser in php can accept 3 different charset encodings.
The create_xml_parser function takes the encoding charset as an optional variable, but the encoding itself can be specified in the <?xml?> tag, as well as in the HTTP header, if the xml is received via web (and in a meta tag, too, if it is actually XHTML).
What is the correct way (as in "following RFC specs to the letter") to determine run-time the xml encoding of a received file and build the appropriate xml_parser ?