You are here: Re: Case sesitivity in XML Tags and simplexml_load_file() « PHP Programming Language « IT news, forums, messages
Re: Case sesitivity in XML Tags and simplexml_load_file()

Posted by Malcolm Dew-Jones on 06/17/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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация