Ask a Question related to PHP Development, Design and Development.
-
Mr. French #1
Problem with parsing an XML file
I'm writing a php program to convert a XML file into html. The XML file is
like a bookmarks, or address list.
The XML file looks something like:
<entry>
<aname>George Dummy</aname>
<aurl>http://www.georgedummy.net</aurt>
</entry>
<entry>
<aname>Fred & Wilma Flintstone</aname>
<aurl>http://fredflintstone.com</aurl>
</entry>
etc.
Now, the problem I'm having is with the '&' in the name. At first, I had
problems with xml_parse simply returning 'false' and not parsing the rest
of the file. After some playing around with htmlentities and the
translation table, I've managed to get xml_parse to succeed and continue
parsing. But, instead of getting:
"Fred & Wilma Flintstone"
in the output, I get
" Wilma Flintstone"
That's not what I want. Optimally, I want to have:
"Fred & Wilma Fintstone"
in both the input and output files. That way, if I need to use other
entities, like é I can put them in the input file in the appropriate
place, and have them come out in the output file as well.
As I said, I can get all entities to work, *except* '&'
At one point, I thought I was having problems with the arg_separator.input
or arg_separator.output variables, but I used ini_set to set both of these
to null and I still have problems.
Anybody have any idea what the problem is and how to fix it?
I'm running PHP on a Unix system, Redhat 7.1. The version of PHP is php
4.3.2.
Mr. French Guest
-
Parsing a .PDF file Question
I have been trying to parse a .PDF file with a PERL program (I'm a REAL newbie, today is my first session with "Perl for Dummies" ) but I'm unable... -
Parsing fields in a log file
I want to parse a web log file that starts with the following lines: #Software: Microsoft Internet Information Services 6.0 #Version: 1.0 #Date:... -
HTML File Parsing
hi, like xml dom and xmlreader used for working with xml files. how can i do this with html files. i want find all the hyperlink tags <a>... -
Parsing a local file
I am trying to build script that will parse a file on the user's computer. There are 2 things that I am not quite sure about. 1) How to read a... -
Help with parsing text file
All, I'm trying to parse a text file with logic that essentially goes like this: 1) open the file for reading with a handle 2) match for a regex... -
Chris #2
Re: Problem with parsing an XML file
try :
$newstring = htmlentities(string from user input);Chris Guest



Reply With Quote

