Questions tagged [parsing]

Parsing is the process of analysing a string of symbols, either in natural language or in computer languages, conforming to the rules of a formal grammar.

Filter by
Sorted by
Tagged with
1
vote
1answer
300 views

Parsing credit info

The main class (SMSHelper) is responsible of query a REST web service which in turn returns an XML string. This helper is going to return a new ...
6
votes
2answers
6k views

Yet another JSON parser and serializer for Qt, but with additional features

I wrote QJson, a utility class in/for Qt, I need you to take a look at. It is both a JSON parser and serializer, but with extended functionality (going beyond the ...
4
votes
1answer
698 views

DnD dice roll parser

Some time ago I've written a small parser (about 250 LoC) which is capable of executing the four arithmetic operators +-*/ as well as a dice-roll operator, ...
4
votes
3answers
434 views

Possible buffer overflow dangers in C log parsing program

After hours of working, I've finally finished my first C log parsing program! (previously was a bash script, now it is C). Although I think I've gotten most everything, I was just wondering if you ...
2
votes
1answer
329 views

HTML downloader and parser for CR

This program downloads a Code Review HTML file and parses it. Could you review my program? Main.java ...
3
votes
1answer
728 views

Unicode parsing in PHP

Firstly, apologies if this is not the correct type of question for here, I had it on the stackoverflow but it was closed with a suggestion I post here. I’m in the process of converting from Latin 15 ...
2
votes
3answers
6k views

Parse an XML file using objects / methods

So I spent a while this morning creating an xml parser in java which is part of a job interview. I would love to have some people tear it apart so I can learn from any mistakes that I made so I can ...
3
votes
2answers
10k views

XML schema parser

I've been working on a lightweight XML schema parser, and have what I think is a moderately clean solution (some parts helped out by previous questions I posted here) so far for obtaining all schema ...
1
vote
1answer
312 views

Bibtex reader using Prolog

I am trying to learn Prolog, and wrote a bibtex reader using GNU Prolog. I would like some feedback on my code in terms of: the way I write Prolog, and how it can be improved. Gist ...
2
votes
3answers
9k views

Splitting a string into words or double-quoted substrings

For various reasons, I'm parsing a string, this code will explain what I'm after: ...
-2
votes
1answer
2k views

CSV parsing in Perl

I am looking for a Perl (5.8.8) script for CSV parsing that would follow CVS standards. (See Wikipedia or RFC-4180 for details) Sure, code should be fast enough, but more important is that it should ...
7
votes
3answers
2k views

Handling various types of nodes when traversing a DOM tree

How to minimize the following code using java's features ... looking for some workaround with the switch-case statement I've seen several question regarding switch-case design pattern / best ...
3
votes
1answer
9k views

Query String Serializer

I have a ASP.NET Web Forms project, and I want to build calls to .aspx pages in a strongly-typed fashion. I ended up rolling my own serializer that takes simple structs and saves them to/loads them ...
3
votes
1answer
181 views

C# expression evaluator review request

I successfully created an expression evaluator in C#, and I would like to know if it works well, and what I can do to improve it. ...
4
votes
3answers
20k views

String parsing in C

This is supposed to be strict ANSI C89 pedantic code. It should extract word1, word2 and ...
6
votes
1answer
262 views

“Best before” puzzle

I'm new To C++ and decided to have a go at the Spotify challenges on their website. I have now finished but I get the feeling my code is just terrible. I'm guessing it would be very hard for someone ...
8
votes
1answer
27k views

Optimize JSON insertion to SQLite (insert … on duplicate key ignore)

In current task, I'm refactoring the code of converting JSON file into SQLite database on Android device. Code compliant with Java 6. As a benchmark, grabbing the code from remote server takes ...
1
vote
1answer
923 views

C-Style unsigned char parsing and manipulation

Note that I'm using a C++ compiler ( hence, the cast on the calloc function calls) to do this, but the code is essentially C. Basically, I have a ...
2
votes
2answers
1k views

Data extraction

I wrote this code in Python/ Scrapy for data extraction. It works fine for me, but I am a newbie in Python, so any suggestions for code optimization would be welcome. ...
3
votes
1answer
3k views

Unit-testing ExtFilterParser Symfony2 service

The Service: ...
2
votes
2answers
379 views

Parse in currency rates of major cities

I'm creating a website that parses in currency rates of the three major cities listed below in the $cities array. ...
4
votes
4answers
3k views

URI parsing and handling class

I wrote a simple class to deal with parsing and handling URIs for the project I'm currently working on, since it relies a lot on that functionality (eg the Router class and some HTML helpers). Here is ...
1
vote
3answers
472 views

Parsing library interface

I have been working on a parser generator, in which I want to employ a sort of fluent configuration interface - avoiding the pre-compile step that usually comes with parser generators. It's supposed ...
4
votes
1answer
262 views

Parser for tab-delimited data as a subclass of StringReader

I wanted to parse lines of text as tab-delimited items, and I had just been using a StringReader for something else and I came up with this: ...
2
votes
1answer
184 views

Game level parser

The code for the LevelParser is shown below. It is also documented using Java-doc; the docs are in the project directory. Now by improving this piece of code, I do ...
10
votes
3answers
3k views

Read a space delimiters settings file in C

I'm a C# programmer and I would like to start getting better at coding in C. I wrote a function which reads a space delimiters settings file (supports comments / and #). The code works fine. But from ...
3
votes
2answers
683 views

Text parser implemented as a generator

I often need to parse tab-separated text (usually from a huge file) into records. I wrote a generator to do that for me; is there anything that could be improved in it, in terms of performance, ...
2
votes
1answer
169 views

Parsing files with county codes

I am running through a file and inserting elements one by one. The counties all contain specific county codes which are duplicated many times throughout the file. I am looking for a way to assign ...
0
votes
1answer
618 views

Python xml schema parsing for simpleContent and simpleTypes

I am writing a few python functions to parse through an xml schema for reuse later to check and create xml docs in this same pattern. Below are two functions I wrote to parse out data from ...
44
votes
1answer
6k views

Yet another C++ JSON parser

This is a framework for a JSON parser I put together last night. Any comments appreciated. JsonLexer.l: Breaks the input into lexemes JsonParser.y: Understands the language syntax JsonParser.h: ...
6
votes
2answers
929 views

Extracting a div from parsed HTML

It seems that lxml/etree are generally imported as from lxml import etree -- why is that? It keeps the code tidier, and while the potential namespace ambiguity ...
2
votes
3answers
276 views

Cleaning up Compiler class

What is the best way to considerably decrease the size of the following code without sacrificing functionality, and to make it more readable, and well, make it look professional? ...
3
votes
1answer
1k views

Variable parser for the Hack programming language

I am optimizing the variable parser for my programming language, and also trying to make it more readable and concise (precedence: readable and concise > efficient). What is the best way to improve ...
5
votes
2answers
12k views

Parsing XML in Python

The aim of this code is to return an object which contains all of the movies. Where attributes are not found, they need to return None rather than be undefined and ...
2
votes
4answers
381 views

Speedily Read and Parse Data

As of now, I am using this code to open a file and read it into a list and parse that list into a string[]: ...
6
votes
1answer
773 views

Using Parsec for lexing&parsing

I'm creating list of Tokens from input [Char] stream using Parsec v3. The definition of Token...
7
votes
1answer
371 views

Song repetition manager with Stack

The exercise was to take a file such as this: ...
3
votes
3answers
227 views

Parsing Placeholders as SQL Arguments in PHP

I am trying to find a good way of parsing SQL arguments, the way I am accomplishing it now seems like it can use a lot of improvement. I am trying to convert arguments that are split apart by ', & ...
3
votes
1answer
4k views

Reading a large XML file and parsing necessary elements into MySQLdb

I have fair concept in a programming (learner) but not an expert to refactor code at the highest level. I am trying to read a huge (100MB-2GB) XML file and parse necessary element (attributes) from a ...
4
votes
4answers
3k views

File parsing code in C++

I'm processing about 3.5gb/15minutes, and I was wondering if I could get this down to a better time... Note that this is for a very specific CSV file, so I am not concerned about generality - only ...
7
votes
3answers
3k views

Google Weather API wrapper

I'm an amateur programmer (self-taught). Anyway, this class provides a few methods to access Google's unofficial weather API. I'm having trouble on how to go about handling parsing errors in ...
8
votes
2answers
7k views

Same code to parse int, float, decimal?

I have a method to parse strings. It can be used to parse a float using a specific culture ...
3
votes
1answer
15k views

XML schema parsing and XML creation from flat files

I am new to Python and had to create a schema parser to pull information on attributes and complex types, etc. and then convert data from flat files into the proper XML format. We are processing a lot ...
4
votes
1answer
4k views

Extracting text fields from <span> tags in an HTML message

What i'm doing I have a string with html information like this: ...
5
votes
1answer
6k views

Code to Parse dollars and cents?

I've written code to parse dollars and cents entered by the user. The value returned is the total number of cents. For example: ...
1
vote
1answer
217 views

Parsing XML file containing some events

I'm a beginner and have written my first Python module that parses a XML file containing some events and prints them out to stdout as JSON. I would appreciate some ...
8
votes
1answer
2k views

Parse Java source code

I have a bunch of simple interfaces like this one (pretty enough formed, but not guarantee) ...
6
votes
2answers
10k views

Parsing JSON with JavaScript

I need to write some JavaScript code that will take a JSON string, parse it, and return the names of the most-deeply nested properties. For example, for this input: ...
5
votes
3answers
395 views

Is this query-string parser bug-free?

I tried to implement a definitive, reliable URL query string parser that handles every corner case: it tries to be efficient by avoiding regex it takes full URLs or just query strings (as long as the ...
3
votes
1answer
554 views

Conditional parsing, non-standard approach

Conditional parsing (aka read some tokens and return true or false). As a solution to this SO question, I wrote following code: ...