|
Posted by Malcolm Dew-Jones on 10/22/89 11:18
Rainer Mohr (rainer.mohr@wiwi.uni-regensburg.de) wrote:
: Hi,
: I΄m having some problems with simplexml_load_file() and cant find any
: sollution anywhere.
: Say, we have the following file:
: ---file.xml---
: <UNITS>Metric</UNITS>
: <UNITS>another</UNITS>
: --------------
: The following code:
: -------------------
: $file = "file.xml";
: $xml = simplexml_load_file($file) or die ("cant read file!");
: echo $xml->UNITS[0];
: -------------------
: Gives me back "Metric", which it should do.
: Now assume someone else uploads the following file:
: ---file.xml---
: <units>Metric</units>
: <units>another</units>
: --------------
: The output is empty, because of the case-sensitivity.
: I cant influence how the user upload the files (upper or lower case in
: the tags), how can i solve this problem?
Why not? The user needs to use the correct format for the data, and XML
is quite definitively case sensitive.
Define a DTD or schema and require the user to send data that is valid
according to that.
: I found xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true )
: but it wont affect simplexml_load_file.
The XML_OPTION_CASE_FOLDING is a kludge to help with handling things like
html, it should always be turned off for any regular xml parsing.
--
This space not for rent.
[Back to original message]
|