parsing

Compiling/parsing meaningful whitespace

Hi I'm looking to make a pseudo Markdown kind of language and a parser to parse it into xhtml. I've never written a compiler... I've taken brief looks at ANTLR and am wondering if ANTLR can handle parsing things with meaningful whitespace? So say I have something like this: some text some other text # bullet point # nest...

How to download web content using C?

I have to write a C parser for online blogs and different word manipulation features. I know how to parse / tokenise stings in C, but how would you on execution download the pages content to a local /tmp directory as an HTML file so I can save the information (the blogs) into a string using I/O? Or, just grab the block of text directly...

How to serialize beautifulsoup access-paths?

i have code, which does something like this: item.previous.parent.parent.aTag['href'] now i would like to be able to add filters fast, so hardcoding is no longer an option. how can i access the same tags with a path coded in a string? of course i could invent some format like [('getattr', 'previous'), ('getattr', 'parent'), ..., ('ge...

what is parsing ?And how we can implement it in j2me?

what is parsing ?And how we can implement it in j2me? ...

iPhone SDK - Problem Parsing XML from RSS feed

I made an RSS reader that gets a feed from blogspot. The text from the story, title, etc. works fine. But the images posted inthe feed show up as links instead of an image. How can I display the images? ...

String parser in C and C#

I have a string, "-(1-cos(R*T))/R", that I need to be evaluated in both C and C#. Is there a library, or a quick way to do this? Or do I need to write my own parser? I'm also assuming that R and T are known and are local variables. ...

When using System.Diagnostic Process, will I miss some output lines between the start of process and start of capturing output?

If I have code such as proc.Start(); string resultOut; while ( (!proc.HasExited && (resultOut = stdOut.ReadLine()) != null)) { // Do some operation based on resultOut } Am I liable to miss some lines from when I start proc to when the capturing/parsing begins or will it wait? If it doesn't what can I do? ...

php get value from textarea

how can i get value from field textarea. i want to detail- i need to parse html page and get value from field textarea not call something like $_POST["textarea"] ...

How does the "edit section" feature on Wikipedia work?

How does Wikipedia implement the "edit this section" feature for its articles, wherein a user can edit just a section of an article, rather than the whole article? I've tried crawling through mediawiki's code by myself, but it's a bit dense for me to understand. Here's my guess (but only a guess): User click's on [edit] in an article....

Find a C# HTML parser find all <script> and give me the line and position info.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>title</title> </head> <body> <a href="aaa.asp?id=1"> I want to get this text </a> <script> var test=function() {} </script> </body> </html> and the result is: line:7, position :4 content: var test=function() {} ...

How can I parse a numeric operation containing +,-,*,/ and parentheses and return the result?

Possible Duplicate: Best algorithm for evaluating a mathematical expression? I mean like when you enter this in Delphi: var i : integer; begin i=5 + 5 + (2 * (3 + 2)) + (1 * 4 + (1 - 3)) end; But I want a command that works in this way: var i : integer; s:string; begin s:='5 + 5 + (2 * (3 + 2)) + (1 * 4 + (1 - 3))'; ...

RegEx to find in-line images in a plain text email message

Certain mail clients allow for the sender to place images directly in the body of their email (instead of as a traditional attachment). When I receive one of these emails in my application, I need to be able to look at only the text/plain message body and determine that the sender embedded an inline image. I'm trying to craft a RegEx t...

Parse text- Scanner or BufferedReader?

For my data structures class, the first project requires a text file of songs to be parsed. An example of input is: ARTIST="unknown" TITLE="Rockabye Baby" LYRICS="Rockabye baby in the treetops When the wind blows your cradle will rock When the bow breaks your cradle will fall Down will come baby cradle and all " I'm wondering the bes...

Objective C try parse boolean

I would like to know how, in Objective-C, how to tell if a string represents a boolean value. The [string boolValue] method will not work, because when I try to parse a string like [@"ERROR" boolValue] it returns NO instead of throwing an exception. In C#, I could do something like: if (Boolean.TryParse(string, out bool)), but this is no...

How to find keyword in Microsoft Technologies

I am creating parser algorithm and i want to know on what basis Microsoft is deciding whether word is keyword. Example: if in a sentence word is noun than that it is keyword. Consider following example text content Hi, I have a base class which contains 4 methods. Class BaseClass { Public void A(){} P...

HTML Parser fetch link text

I'm using HTML Parser to fetch links from a web page. I need to store the URL, link text and the URL to the parent page containing the link. I have managed to get the link URL as well as the parent URL. I still ned to get the link text. <a href="url">link text</a> Unfortunately I'm having a hard time figuring it out, any help would ...

php - parse html page

<div>divbox</div> <p>para1</p> <p>para2</p> <p>para3</p> <table class="table"><tr><td></td></tr></table> <p>para4</p> <p>para5</p> could someone please tell me how i can parse this html page to display ONLY para1, para2 and para3? and remove everything else. condition: i want to fetch all the content from the first <p> to the first <t...

Facing a weird situation in PHP while parsing a file

I am reading some lines from a file in the following format: Identifier String Number String Number String Number String Number Identifier String Number String Number String Number Identifier String Number String Number Identifier String Number String Number String Number String Number String Number In the file that was given to me, ...

Simple Perl Regex parser

Hey, I am working on a very basic parser. I am almost certain that my regex is correct, but values do not seem to be being stored in my $1 and $2. Am I doing something wrong? I am just looking for tips to alter my code. Thanks for any advice! Also, I am new to Perl, so if I did something wrong, I am looking to get off on the right foot a...

How to parse information in PHP?

I have the following text below, what is the easiest way to parse through it? if(typeof sa_inst.apiCB == 'function') sa_inst.apiCB({"AS":{"Query":"g","FullResults":1,"Results":[{"Type":"AS","Suggests":[{"Txt":"g<strong>oogle</strong>","Type":"AS","Sk":""},{"Txt":"g<strong>mail</strong>","Type":"AS","Sk":"AS1"},{"Txt":"g<strong>oogle</st...