Hi, I have an xml file which I cant change, the problem is that the
first line looks like this <?xml version="1.0" ?> with the rest of
the xml being fine. However when I try to parse this I am getting a
malformed xml error. THis line was added recently, the parser worked
before. My question is how can I get rid of this first line in the
xml file - which I get from an internet feed using
fopen("http://dsfsf.com/sdf.xml", r);
Thanks
Kemal 4 5871
On 16 Dec 2003 16:39:22 -0800, u0**@dcs.shef.ac.uk (Kemal) wrote: Hi, I have an xml file which I cant change, the problem is that the first line looks like this <?xml version="1.0" ?> with the rest of the xml being fine. However when I try to parse this I am getting a malformed xml error. THis line was added recently, the parser worked before. My question is how can I get rid of this first line in the xml file - which I get from an internet feed using fopen("http://dsfsf.com/sdf.xml", r);
What XML parser are you using? XML documents are supposed to start with that.
--
Andy Hassall (an**@andyh.co.uk) icq(5747695) ( http://www.andyh.co.uk)
Space: disk usage analysis tool ( http://www.andyhsoftware.co.uk/space)
Kemal wrote: Hi, I have an xml file which I cant change, the problem is that the first line looks like this <?xml version="1.0" ?> with the rest of the xml being fine. However when I try to parse this I am getting a malformed xml error. THis line was added recently, the parser worked before. My question is how can I get rid of this first line in the xml file - which I get from an internet feed using fopen("http://dsfsf.com/sdf.xml", r);
Thanks
Kemal
If you are sure, *REALLY* sure, you want to do that,
try
<?php
$fh = fopen('whatever', 'r');
$dummy = fgets($fh);
$contents = '';
while ($line = fgets($fh)) $contents.=$line;
fclose($fh);
// parse $contents now
?>
*BUT* that is the proper way to start a XML file.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Pedro Graca <he****@hotpop.com> wrote in message news:<br************@ID-203069.news.uni-berlin.de>... Kemal wrote: Hi, I have an xml file which I cant change, the problem is that the first line looks like this <?xml version="1.0" ?> with the rest of the xml being fine. However when I try to parse this I am getting a malformed xml error. THis line was added recently, the parser worked before. My question is how can I get rid of this first line in the xml file - which I get from an internet feed using fopen("http://dsfsf.com/sdf.xml", r);
Thanks
Kemal
If you are sure, *REALLY* sure, you want to do that, try
<?php $fh = fopen('whatever', 'r'); $dummy = fgets($fh); $contents = ''; while ($line = fgets($fh)) $contents.=$line; fclose($fh); // parse $contents now ?>
*BUT* that is the proper way to start a XML file.
OK its started to work again now on its own. This is really bizzare!
I thought it was the correct way to start the file but the parser was
complaining about an error in the xml on line 1, so I assumed it was
that. Its still there but its working now. I dont get it!
Regarding this well-known quote, often attributed to Kemal's famous "17 Dec
2003 02:23:47 -0800" speech: Pedro Graca <he****@hotpop.com> wrote in message news:<br************@ID-203069.news.uni-berlin.de>... Kemal wrote: Hi, I have an xml file which I cant change, the problem is that the first line looks like this <?xml version="1.0" ?> with the rest of the xml being fine. However when I try to parse this I am getting a malformed xml error. THis line was added recently, the parser worked before. My question is how can I get rid of this first line in the xml file - which I get from an internet feed using fopen("http://dsfsf.com/sdf.xml", r);
Thanks
Kemal
If you are sure, *REALLY* sure, you want to do that, try
<?php $fh = fopen('whatever', 'r'); $dummy = fgets($fh); $contents = ''; while ($line = fgets($fh)) $contents.=$line; fclose($fh); // parse $contents now ?>
*BUT* that is the proper way to start a XML file.
OK its started to work again now on its own. This is really bizzare! I thought it was the correct way to start the file but the parser was complaining about an error in the xml on line 1, so I assumed it was that. Its still there but its working now. I dont get it!
Hmm... makes me wonder if it was something like an ASCII/Binary mixup, or
some kind of CR/LF issue. Although it would choke on every line, it would
bomb first on Line 1.
--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ramon Felciano |
last post by:
Hi --
I'm using the csv module to parse a tab-delimited file and wondered
whether there was a more elegant way to skip an possible header line.
I'm doing
line = 0
reader =...
|
by: FrancisC |
last post by:
How can I open a file, skip first 2 lines and get the 50th character?
EXP 0 R:\000\un\111\e00\e00noLog\1006\bdry_arc.e00
ARC 2
1 1 0 0 0 0 7
...
|
by: puzzlecracker |
last post by:
I want to read lines and skip blank lines:
would this work considering the lines can contain tabs, spaces, etc.?
file.in:
------
line1
line2
|
by: ecomputerdelicacy |
last post by:
Compact Framework SP3 (and I think also SP2 and SP1) XmlTextReader does not
handle !DOCTYPE and (maybe?) rdf elements. How can I get the XmlTextReader to
read these without issuing a...
|
by: Robin Cole |
last post by:
I'd like a code review if anyone has the time. The code implements a basic
skip list library for generic use. I use the following header for debug
macros:
/*
public.h - Public declarations and...
|
by: Adam Witney |
last post by:
Hi,
Is it possible for the COPY command to read data from a file, but skip
specific columns?
Thanks
Adam
|
by: tjuiowa |
last post by:
Hi
I am trying to import a text file into a MS Access database. The first 11 lines of the text file are in a different format, so i would like to skip those lines and start at line 12. is there...
|
by: luckyyyyyy |
last post by:
I appriate your work but...
guys i have another problm.....i wana skip first 9 lines from my data file and after skipping i wana read x,y,z at the end of file. i did but after while loop is end it...
|
by: raghudr |
last post by:
Hi all,
I am parsing a .xml file.My main intention is to retrieve the name
value of node "Signal":- "Name Value" which is
"rag".
i want to store only the <signal"name value" that is only...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |