parsing

How to avoid DOM parsing adding html doctype, had and body tags?

<? $string = ' Some photos<br> <span class="naslov_slike">photo_by_ile_IMG_1676-01</span><br /> <span class="naslov_slike">photo_by_ile_IMG_1699-01</span><br /> <span class="naslov_slike">photo_by_ile_IMG_1697-01</span><br /> <span class="naslov_slike">photo_by_ile_IMG_1695-01</span><br /> '; $dom = new ...

parser combinator: how to terminate repetition on keyword

I'm trying to figure out how to terminate a repetition of words using a keyword. An example: class CAQueryLanguage extends JavaTokenParsers { def expression = ("START" ~ words ~ "END") ^^ { x => println("expression: " + x); x } def words = rep(word) ^^ { x => println("words: " + x) x } ...

How does one get the system time in XML? Is there a method/function?

I am using an XML file to store data and parameters which is to be used by a parser, however in that XML I also have to use system time. So, is there any built-in functionality in XML to get system time, perhaps something similar to getTime() in Javascript? ...

jQuery AJAX parsererror

I am working on the following page. http://www.ranger.ryerson.ca/library/test/steveDev/testcarousel/test.html it works in firefox, chrome, and opera, but in IE6,IE7, and Safari (the god forsaken browsers) they all give me "parsererror" My page uses the jquery XML parser, and the bad browsers dont like it. The troubled code is the foll...

Convert a 'css' or 'json' style string into a Hash/Dictionary or Kvp<T,T> ?

Does anyone know if there is a way to convert the following string into an object? "width: 100px; height: 20px; border: solid 1px black;" As you notice, this is a standard CSS property. I know it would be fairly trivial to split on ';' and do the work myself, but looking at some other languages it seems they have native support to do...

Haskell recursive problem, tiny parser. Check variables

I'm still working on a tiny parser for a tiny language defined in a task at school. The parser that generates an AST(Abstract syntax tree) is working. What I want is to check the defined variables, they must be bounded by the let expression. First the method that is defined in the task(suggestion, not needed): checkVars :: Expr -> Char...

Htmlnode collection and parsing

Hi, I'm trying to extract the text contained in a webpage. So that I'm using a third pary tool Html Agility Pack. In that they mentioned HtmlWeb htmlWeb = new HtmlWeb(); HtmlDocument doc = htmlWeb.Load("http://www.msn.com/"); HtmlNodeCollection links = doc.DocumentNode.SelectNodes("//a[@href]"); foreach (HtmlNode link in links) { Resp...

Designing a poker parser in Ruby

I'm writing a small program in Ruby to parse a hand history log from a poker site. The log is split over several lines and looks a bit like this: Table 123456 NL Hold'em $1/$2 5 Players Seat 3 is the button Seat 1: randomGuy112 $152.56 Seat 2: randomGirl99 $200 Seat 3: PokerPro $357.12 Seat 4: FishCake556 $57.19 Seat 6: MooMoo $188.98 D...

SimpleParse non-deterministic grammar until runtime

Hi I'm working on a basic networking protocol in Python, which should be able to transfer both ASCII strings (read: EOL-terminated) and binary data. For the latter to be possible, I chose to create the grammar such that it contains the number of bytes to come which are going to be binary. For SimpleParse, the grammar would look like th...

PHP CLI vs PHP WEB

Hiya All, I am currently running a script that i've created in PHP that parses and sorts out 6 different xml files of around 40mb each. I currently run the script through a browser, and a cron job to wget the page. But sometimes with the server load it can clog up apache and and the rest of the server, Would it make sense to convert...

How good is this representation of a context free grammar for a parser?

i have shared the header file containing class definition of a Context Free grammar for a parser. Could you comment on the design. this code is for my lab assignment. may be we could get some good programming tips out of this code. is the class heirarchy good or too complicated. #ifndef CFG_H #define CFG_H #include <iostream> #include ...

Simple parsing of html file for <U></U> values in .net?

Looking for a simple means in .NET to parse an html file to get back all values within <u></u> tags. Ex: <U>105F</U> There may be many of these in the file with other tags but all I need is to loop through and get back a list of all the values so they cna then be processed. Looking for a light small way to handle this. ...

calculator issue

I want to design a special calculator .. and I came to a problem like this : X=1+(12*4+2) i need to get number of operands first like here i have two operands 1 and (12*4+2) how could i distinguish between the outer + and the inner one ? thanks what an amazing community here .. different answers from easiest to hardest .. guyz my pro...

feed text parser

I'm getting text from an API and it's something like following: text = 'replied to @james and he was visiting this http://some-site.com/another/something/../ so what you think about it'; How can I parse this text and make links as html links and @james as html links also, but with their own href values. Does anyone know any function ...

Attributes of XML node using Javascript

Is there a way to get the name of an attribute of an XML node using javascript. Lets take this as a sample XML <?xml version="1.0" encoding="UTF-8"?> <Employees> <Count name="EmployeeCount">100</Count> <employee id="9999" >Harish</employee> <Salary> <year id="2000">50 Grands</year> <year id="2001">75 Grands<...

API/XMLfor Google Search Results?

Technically, I know how to download pages, and use parsers to parse them. However, I'd like to know if there is an API or a simple XML format that I can use to parse their results. ...

Problem with parsing data via php and storing it to MySQL database

Sorry for duplicating this question, but here I tried to explain it in more details. I need to parse the data from certain file and store it to database (MySQL). This is how the data is displayed in the file: 戚谊 戚誼 [m1][b]qīyì[/b][/m] [m2]translation 1[/m] [m1][b]qīyi[b][/m] [m2]translation 2[/m] 三州府 [m1][b]sā...

Errors When Using Bison

Now I'm getting other things. When I do a bison -d calc.y I'm getting many source codes in the console (with many m4_define), but it doesn't generate any file. Now my code is like this: %{ #define YYSTYPE double #include <math.h> %} %token NUM %% input: /* empty */ | input line ; line: '\n' | exp '\n' { printf...

Parsing text content in ColdFusion

Hi guys, I am attempting to parse text from a <cfoutput query="...">. I am interested in finding the number of times every word in the text is displayed. For example: "My name is Bob and I like to Bob". should result in Bob - 2 Name - 1 etc, etc, etc. I take my <cfoutput> from a twitter RSS feed. Here is my code: <blink> <cfse...

How to interpret the these time stamps?

I'm trying to parse the time stamps written in some xml files. Most to the time time stamps are something like 2009-07-22-07:00 but some times I find them something like 2009-07-22Z or 2009-07-22z. Kindly help me how to interpret these Zs and how to parse them. I thing these z or Z is related to the time zone. Any workarounds to parse th...