In stock PHP5, what is a good preg_replace expression for making this transformation:
replace newlines with <br />, but only within <pre> blocks
(Feel free to make simplifying assumptions, and ignore corner cases. For example, we can
assume that tags will be one line, and not pathological things like )
Input text:
<div><pre class='s...
what is the main differences between syntax language and s-expressions language ? does using s-expressions affects compiling time (in the parsing process) or does it bring any advantage to the language ?
...
heya,
I've been asked to quickly put together a small system that takes a Yahoo XML feed, parses it, and creates a HTML fragment based on it.
At the moment, I'm using Django to handle the URL routing, with some Python script, and outputting a bit of HTML in a (with hardcoded dimensions as inline CSS), that can hopefully be put into an...
in html an rss link looks somewhat like this
<a class="rsslink" href="http:the_url">The feed title</a>
i would like to get all links that match this description from a html page that has a list of rss feeds. anyone know of a good way to parse, with some sample code?
...
hi all,
i want to parse the XML file. i am enable to parse simple XML file. but there are little complex XML file
<?xml version="1.0" encoding="utf-8"?>
<Level>
<p id='327'>
<Item>
<Id>5877</Id>
<Type>0</Type>
<Icon>---</Icon>
<Title>Btn1Item1</Title>
</Item>
<Item>
<Id>5925</Id>
<Type>0</T...
hello all,
i have a text file that contains font information like this:
Arial, 12.5
...and I need to read that info into label.Font like this:
label.Font = new Font(fontNameFields[0], Single.Parse(fontNameFields[1]));
... but I always get the following error:
Index was outside the bounds of the Array.
Can somebody please help me w...
hi all,
i want to parse the xml File. xml File structure is following
<?xml version="1.0" encoding="utf-8"?>
<Level>
<p id='327'>
<Item>
<Id>5877</Id>
<Type>0</Type>
<Icon>---</Icon>
<Title>Btn1Item1</Title>
</Item>
<Item>
<Id>5925</Id>
<Type>0</Type>
<Icon>---</Icon>
<Title>Btn1I...
hello all,
i keep getting an "Index is out of bounds of array" error on line # 574 which is:
label.Font = new Font(fontNameFields[0], Single.Parse(fontNameFields[1]));
... The following text file i am parsing contains this exact information:
Label
"hi tyler"
23, 76
Arial,12.5
...I can successfully parse all the other info (just not...
With Ruby's regular expressions I could write /[0-9]{3,}/ I can't figure out how to write this in treetop other than:
rule at_least_three_digit_number
[0-9] [0-9] [0-9]+
end
Is there a 'match [at least|most] n' rule for treetop?
...
I'm looking for a way to parse c++ code to retrieve some basic information about classes. I don't actually need much information from the code itself, but I do need it to handle things like macros and templates. In short, I want to extract the "structure" of the code, what you would show in a UML diagram.
For each class/struct/union/enu...
Currently i am using and have looked through this code http://us.php.net/manual/en/function.xml-set-element-handler.php#85970
How do i get the text between tags?
i am using php5 and XML Parser
...
data Expr = Var Char | Tall Int | Sum Expr Expr | Mult Expr Expr | Neg Expr | Let Expr Expr Expr
deriving(Eq, Show)
That is the datatype for Expr, I have a few questions. I'm suppose to parse expressions like *(Expr,Expr) as shown in the datatype definition. However I do have some problems with "creating" a valid Expr. I use patte...
I'm trying to use simple html DOM to extract everything inside a tag with the class "sitepoint". Here is my code that doesn't work:
<?php
include_once('simple_html_dom.php');
$html = file_get_html('examplewebsite');
$ret = $html->find('.sitepoint');
echo $ret;
?>
Below is an example of one of the sitepoint tags (there are ten or so)...
What is an efficient, proper way of reading in a data file with mixed characters? For example, I have a data file that contains a mixture of data loaded from other files, 32-bit integers, characters and strings. Currently, I am using an fstream object, but it gets stopped once it hits an int32 or the end of a string. if i add random d...
I've been having a hard time trying to get the right answers for my problem. And have spent numerous days searching online and in documentation and have found nothing.
I have a Text File that contains a bunch of text. And on one of those lines inside the file will contain some Font info like this:
Tahoma,12.5,Regular
Note that the fon...
Hi ,
I am using xStream for serializing and de-serializing objects. But when there is "&" present for any of the tag values , xStream is failing and throwing excpetion.
for e.g. this fails..
<tag>value & value</tag>
Exception :- "An entity name must immediately follow..."
<tag>value value</tag>
this passes
Is there any way to tell...
I have PDFs with filled out form fields from a customer, which have to be parsed with PHP5 and written into a MySQL-DB.
With Google I only find libraries, like Zend_Pdf, which are helpful for creating or manipulating PDFs but not for parsing for form fields. Do you know any libraries or classes for this task?
...
data Expr = Var Char | Tall Int | Sum Expr Expr | Mult Expr Expr | Neg Expr | Let Expr Expr Expr
deriving(Eq, Show)
parseExpr :: String -> (Expr, String)
parseExpr ('*':'(':s) = (Mult x y, s'')
where (x,',':s') = parseExpr s
(y,')':s'') = parseExpr s'
parseExpr ('+':'(':s) = (Sum x y, s'')
where (x,',':s') = par...
Hi, so I was having a problem parsing a date, using the JodaTime chronology IslamicChronology so wrote a small example to demonstrate my problem.
Here's the code:
import org.joda.time.Chronology;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.chrono.IslamicChronology;
im...
I've been a big fan of the site and frankly this is the first time I ever came across a problem that Stackoverflow didn't have the answer to.
I need to grab some content from an html(xhtml valid) page. I grab the page using curl and store it in memory. I played with the idea of using regex with the PCRE library, but simply I couldn't fi...