parsing

ICalendar parser in PHP that supports timezones

I am looking for a PHP class that can parse an ICalendar (ICS) file and correctly handle timezones. I already created an ICS parser myself but it can only handle timezones known to PHP (like 'Europe/Paris'). Unfortunately, ICS file generated by Evolution (default calendar software of Ubuntu) does not use default timezone IDs. It export...

HTML Agility Pack - Get Page Summary

How would I use the HTML Agility Pack to get the First Paragraph of text from the body of an HTML file. I'm building a DIGG style link submission tool, and want to get the title and the first paragraph of text. Title is easy, any suggestions for how I might get the first paragraph of text from the body? I guess it could be within P or...

Replacing a new line with its html equivalent in PHP

I am facing a bit of a quandary, I need to replace a new line with <br />. Now, clearly, replacing all instances of \n did not work, as the page did not have proper linebreaks. Here is an example of some possible text: Some text More text Now, this is an issue because there is no \n and I have no way to auto-insert <br />. How can I...

Building a markup parser in php

I have created a very simple markup parser in php. However, it currently uses str_replace to switch between markup and html. How can I make a "code" box of sorts (will eventually use GeSHI) that has the contents untouched? Right now, the following markup: [code][b]Some bold text[/b][/code] winds up parsing as the code box with <b>Some b...

C++ Parsing a line out of a large file

I have read an entire file into a string from a memory mapped file Win API CreateFile( "WarandPeace.txt", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ) etc... Each line is terminated with a CRLF. I need to find something on a line like "Spam" in the line "I love Spam and Eggs" (and return the entire lin...

XML parsing in objective-c

Hi all, I have a xml source and now i would like to present in my tableview. Source code for xml: <NewsML> <Catalog Href="http://www.afp.com/dtd/AFPCatalog.xml"/&gt; <NewsEnvelope> <DateAndTime>20091123T171818Z</DateAndTime> </NewsEnvelope> <NewsItem> <Identification> <NewsIdentifier> <ProviderId>afp.com</Provid...

Code crash on iPhone Simulator but works on actual iPhone device?

This is an extremely weird problem: wondering if anybody has experienced this before. My code, an RSS parser of Flickr photos (RSS feed), works perfectly on an actual device, but allocates a ton of memory and freezes up my entire computer when run on the simulator. I know usually it's the other way round for people, but this is acting w...

What is parsing?

Parsing is something i come accross alot in development, but as a junior its one of those things i assume i will get the hang of at some point, when its needed. In my current project ive been told to find and use an HTML parser for a certain function, I have found a couple on the web, but what does an HTML parser actually do? And what do...

Getting java source method name list given an ANTLR java grammar?

Given an ANTLR Java Grammar - what java source code would I write to get a list of method names in a java source listing? eg for the following public class HelloWorld { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new HelloWorld().printHelloWorld(); ...

Parse user-input concerning search criteria

I'm looking for a way to parse some user-input. The input should show which searches have to be performed and how they have to be combined. 1 AND 2 (3 AND 2) OR 1 (3 AND 2) OR (1 AND 4) ( (3 OR 4) AND 1) OR 2 etc. The first example should combine the results of search 1 and 2 in an AND-fashion. The second example should combine the r...

Help me to take value from Web Service using DOM parser

I have 2 table. Table A has ID (int, auto_increase), Name (Varchar), City_ForeignKey (Int, Reference to ID from table B) Table B ID (int, auto increase) Name City (Varchar) than i make Web Service from table A & B and success. When i make a client, i parse the Web Service XML from table A,it's problem to City_ForeignKey, when i want t...

Parsing an Object into a String

Hi there I am looking to parse an Object I have into a String so that I can enter it's value into a textfield. Here is a little snippet. TFname is the name of the textfield Object value = list.getSelectedValues(); TFname.setText(parseObject(value)); //-- Here I pick up an error Where I pick up the error, I know it's because this isn'...

Java Math(s) Parsing API

Following on from my previous question, I was wondering if anyone knew of any free (as in beer, as in freedom would be nice but not essential) math(s) parsing libraries for Java. I found one called Jep which used to be open-source (ie: written by the community), but now costs $300 upwards (is this even legal?). Any help appreciated! ...

IIS7 parse error.

I just put all my aspx files on the local folder and made a website in IIS7. I added a virtual directory to it and then converted the virtual directory to application. The website loads properly but when i click the link that calls my application i get this error message. Description: An error occurred during the parsing of a resource r...

ANTLR parser hanging at proxy.handshake call

I am attempting to get a basic ECMAScript parser working, and found a complete ANTLR grammar for ECMAScript 3, which appears to compile ok and produces the appropriate Lexer/Parser/Walker Java files. (Running inside ANTLR IDE plugin for Eclipse 3.5) However, when actually trying to use it with some simple test code (following guide on A...

Ideas for Natural Language Processing project?

I have to do a final project for my computational linguistics class. We've been using OCaml the entire time, but I also have familiarity with Java. We've studied morphology, FSMs, collecting parse trees, CYK parsing, tries, pushdown automata, regular expressions, formal language theory, some semantics, etc. Here are some ideas I've come...

J2ME String to XML doc

Hi I'm currently calling a web service from my J2ME app and receiving the xml document as a string object. is it possible to convert the string object to a document type? Can I navigate the document inside the string? Any answers would be appreciated, been googling for a while and so far, no good. ...

coercive parsing attack

when studying about xml vulnerabilities , i came accross coercive parsing attack. can anybody say what exactly is Coercive parsing attack(in SOA applications). How does the attack take place? How can one implement this attack using xml parser in java? ...

Scala Parser Token Delimiter Problem

I'm trying to define a grammar for the commands below. object ParserWorkshop { def main(args: Array[String]) = { ChoiceParser("todo link todo to database") ChoiceParser("todo link todo to database deadline: next tuesday context: app.model") } } The second command should be tokenized as: action = todo message =...

pattern matching an array, not their elements per se

Hi I'm looking for a way of pattern matching the "geometry" of an array, the order in which the elements appear, not the contents of each element directly. Let me outline what I mean by some examples. Given the target array: array('T_STRING','T_VARIABLE','ASSIGN','T_STRING','LPAREN','T_VARIABLE','COMMA','T_VARIABLE','RPAREN'); //as a ...