473,765 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Would a lack of line breaks in a doc cause parsing problems ?

I am fetching some product feeds with PHP like this

$merch = substr($key,1);
$feed = file_get_conten ts($_POST['data_url'.$mer ch]);
$fp = fopen("./feeds/feed".$merch.". txt","w+");
fwrite ($fp,$feed);
fclose ($fp);

and then parsing them with PHP's native parsing functions. This is
succesful for most of the feeds, but a couple of them claim to be
empty when I know they are not. On inspection, the thing these failing
feeds have in common is that they contain no line breaks at all.
Should this cause a problem ?

Sep 26 '07
13 2834
Richard Tobin wrote:
Matching up brackets in huge strings is supposed to be just the sort
of thing computers are good at!
But humans aren't, and in my experience CDATA Sections tend to get used
because humans are creating the file or are expected to edit it.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Sep 27 '07 #11
In article <46fbc796$1@kcn ews01>,
Joseph Kesselman <ke************ @comcast.netwro te:
>Matching up brackets in huge strings is supposed to be just the sort
of thing computers are good at!
>But humans aren't, and in my experience CDATA Sections tend to get used
because humans are creating the file or are expected to edit it.
Yes, but the CDATA sections in this particular file are correct, so
there is no reason why they should cause problems for a parser.
Having lots of correct CDATA sections is not a plausible reason for a
parser to fail.

-- Richard
--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Sep 27 '07 #12
Having lots of correct CDATA sections is not a plausible reason for a
parser to fail.
Having taken a quick look, I see no plausible reason for a parser to
fail on that file, period. So we're stuck with looking for non-plausible
reasons... or saying "check your code, check with the parser's authors;
either you did something wrong or they did or both."

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Sep 27 '07 #13
Joe Kesselman wrote:
Took a quick look. That is one gawdawful long line (about 4MB, .5MB of
which is wasted on the CDATA Section delimiters).

I suspect you've overloaded some buffering limit in your parser.
Test this by turning all space characters into newlines, eg

get http://fcshirtshop.com/feeds/feed1058.txt | tr '\040' '\012' | parse

or whatever syntax your system uses.

///Peter
Sep 27 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
17977
by: leegold | last post by:
Why does float:right cause a line break? Try the code below. Is there a fix? I want the link on the same line as the text. Thanks <html> <head> <STYLE> span.linkpos { float:right; clear: none; color:blue; } </style> </head>
1
346
by: ChrisC | last post by:
Im having trouble removing line breaks from my c# string. Actually, im having trouble getting .Trim() to work properly, as it seems to count a string that has nowt but a break of some sort as not being empty. To get trim to work properly im trying to axe out the line breaks seperately. Ive got .replace("/r") and "/n" but still having problems with some strings. Are there paragraph markers or something I should be removing too? how do i...
7
1169
by: S Borg | last post by:
Hello, I am parsing text from one document to another. I have a scheme similar to: for x in myfoobar: print >> mytextfile, "%s " % mydictionary, #all on same line print >> mytextfile, '\n' #new line
4
58507
by: Water Cooler v2 | last post by:
Besides embedding <BR/>, like general purpose programming languages, I thought you could embed escape sequences such as \n or \r\n into string arguments to cause line breaks in JavaScript. To test, I tried this: <BODY> <BR/><BR/>
5
16852
by: joelbyrd | last post by:
Didn't know exactly where to post this, but: How do I get line breaks in a textarea? I'm pulling text from a database, and this text definately has line breaks in it, because I replaced all the line breaks with <br /> tags ( using the php function nl2br() ), and <br /> tags showed up in the textarea.
1
2155
by: Sky | last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but be Type, AssemblyName. Fair enough, get the reason. (Finally!). As long as it doesn't cause tech support problems down the line... What happens when my code is run on a station that only has framework 3.0 or 4.0, and this assembly, with version number defined for 2.0.0.0 , isn't available. ...breaks? Second question: Does an assembly's PublicKeyToken change...
1
1945
by: =?ISO-8859-1?Q?thib=B4?= | last post by:
Hi, Taking a closer look to highlight_file() lastly, I found out that its line break policy was a bit.. strange. <?php # highlight_file() line breaks test $f = fopen('highlight_file_test', 'w'); fwrite($f, highlight_file(__FILE__, true)); fclose($f); ?>
2
1489
by: Bill H | last post by:
I have the same version of php running on our linux server as I have on my local xampp runing under windows. While working yesterday a piece of code I wrote just wouldn't work on the server, but ran fine under xampp. The code in question opened a file and reads in the contents line by line using a construct similar to this: if ($line != "") { $xmlString .= "<setup value\"$line\" />\n"; }
53
12130
by: Gianni Mariani | last post by:
Do you have a preference on maximum line width for C++ code? I've seen the craziest debates on this most silly of topic. I have witnessed engineers spent oodles of time fiddling with line breaks just to get it right. I find in general a prescriptive rule makes for markedly less readable code, which unfortunately is a subjective argument, however, the waste of time modifying code when it does not need to is not.
0
9568
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10156
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.