parsing

PHP: re-parse entire page before serving?

At the end of a page, if something occurs, it needs to be cleared, then the entire page needs to be re-parsed before serving to the client. I was going to echo out a javascript to refresh the page, but that will make them load the page and then reload it...I was wondering if there was a way to just tell the php engine to go back to the b...

What is an XML parser? Using Expat

This might seem like a simple question. But I have been looking for an XML parser to use in one of my applications that is running on Linux. I am using Expat and have parsed my XML file by reading one in. However, the output is the same as the input. This is my file I am reading in: <?xml version="1.0" encoding="utf-8"?> <books> ...

Geting xml data using xml parser expat

Hello, I have managed to parse ok. But now I am having trouble getting the values that I need. I can get the element and the attributes. But cannot get the values. I would like to get the value of frame in this xml it is 20. /* track the current level in the xml tree */ static int depth = 0; /* first when start element is encountered *...

Nokogiri (RubyGem): Find and replace HTML tags

I have the following HTML: <html> <body> <h1>Foo</h1> <p>The quick brown fox.</p> <h1>Bar</h1> <p>Jumps over the lazy dog.</p> </body> </html> ...and by using the RubyGem Nokogiri (a hpricot replacement), I'd like to change it into the following HTML: <html> <body> <p class="title">Foo</p> <p>The quick brown fox.</p> <p class="title"...

Which Java oriented lexer parser for simple project (ANTLR, DIY, etc)

I am working on a small text editor project and want to add basic syntax highlighting for a couple of languages (Java, XML..just to name a few). As a learning experience I wanted to add one of the popular or non popular Java lexer parser. What project do you recommend. Antlr is probably the most well known, but it seems pretty complex...

How to perform calculation over a log file

I have a that looks like this: I, [2009-03-04T15:03:25.502546 #17925] INFO -- : [8541, 931, 0, 0] I, [2009-03-04T15:03:26.094855 #17925] INFO -- : [8545, 6678, 0, 0] I, [2009-03-04T15:03:26.353079 #17925] INFO -- : [5448, 1598, 185, 0] I, [2009-03-04T15:03:26.360148 #17925] INFO -- : [8555, 1747, 0, 0] I, [2009-03-04T15:03:26.367523...

Parser using RegEx and XML, in C#

I am making an application where I need to verify the syntax of each line which contains a command involving a keyword as the first word. Also, if the syntax is correct I need to check the type of the variables used in the keywords. Like if there's a print command: print "string" < variable < "some another string" //some comments ...

_splitpath in linux

Is there a linux equivalent of the win32 API _splitpath in linux? Details added: void _splitpath ( const char *path, // Path Input char *drive, // Drive : Output char *dir, // Directory : Output char *fname, // Filename : Output char *ext // Extension : Output ); It takes full path as...

.Net string parsing library, or regex for parsing .Net code files

I would like to be able to parse vb.net code files, so I can examine the collection of Subs, Functions (and their contents, including comments), private variables, etc. I can be open the actual source code files. So for example, if I have: Public Function FunctionOne(arg1 As String, arg2 as String) as Integer here is some code '...

Parsing a string in C++

I have a huge set of log lines and I need to parse each line (so efficiency is very important). Each log line is of the form cust_name time_start time_end (IP or URL )* So ip address, time, time and a possibly empty list of ip addresses or urls separated by semicolons. If there is only ip or url in the last list there is no separato...

Looking for a self-contained equation rendering library

Is there such a thing as a small, self-contained library that will render an equation written in a text-based format (e.g. LaTeX or MathML) to an image (either vector or raster)? It would be preferable if it's in Python or Python-friendly. (One possibility that I've found: Matplotlib has Python code to parse and display LaTeX equation...

Trouble parsing multi-level JSON

I have a chunk of JSON which looks something like: { "map": [ [ "zimbraFeatureCalendarUpsellEnabled", "FALSE" ], [ "zimbraPrefCalendarDayHourStart", "8" ], [ "zimbraFeatureOptionsEnabled", "TRUE" ], [ "zimbraAttachmentsViewInHtmlOnly", "FALSE"...

How's the best way to go from a Cobol/CICS system to a modern Oracle/C++/Server setup

We plan to migrate an old IBM/COBOL/DB2 legacy app to a Solaris/Oracle/C++ "setuped" world. My specific questions here are: are there any experiences with tools able to analyze COBOL code in a more model driven view? (e.g. data flow analysis, code flow analysis, cross/hyperref listings, pretty printing) is openCOBOL a real chance to go...

Using Lex tokenizers in an embedded system

I'm trying to write a config-file parser for use in a non-standard C environment. Specifically, I can't rely on the utilities provided by <stdio.h>. I'm looking to use Flex, but I need to use my own input structures rather than <stdio.h>'s FILE pointers. ...

What is the difference between Flex/Lex and Yacc/Bison ?

What is the difference between Flex & Lex and Yacc & Bison. I searched the Internet wildly and I didn't find any solid answer. Can I install pure Lex and Yacc on Ubuntu, or I can install only flex and bison. I am confused. Is Lex or Yacc still being maintained by someone ? Are all of them free ? If Lex is not free why do I have it in...

Problem with dynamically parsing the VBA File

I have an MS Office 2003 excel file with macro. I have to parse the VBA code in macro using c#. While parsing i have to identify whether the keyword is a method name or property. And also is there a component from Microsoft to access all the VBA functions dynamically using reflection in c#? Is there a way to do this? If so please sugg...

How to parse an excel file in JavaScript?

I am trying to write a small web tool which takes an Excel file, parses the contents and then compares the data with another dataset. Can this be easily done in JavaScript? Is there a JavaScript library which does this? ...

Can I create an XML document from dtd file in Java?

I have a simple DTD file with elements and attributes specifications. Can i create a suitable XML file (with DOM) parsing this DTD with Java and no external APIs? Thanks in advance ...

Need help on making the recursive parser using pyparsing

I am trying the python pyparsing for parsing. I got stuck up while making the recursive parser. Let me explain the problem I want to make the Cartesian product of the elements. The syntax is cross({elements },{element}) I put in more specific way cross({a},{c1}) or cross({a,b},{c1}) or cross({a,b,c,d},{c1}) or So the general f...

C# Extension Method - String Split that also accepts an Escape Character

I'd like to write an extension method for the .NET String class. I'd like it to be a special varation on the Split method - one that takes an escape character to prevent splitting the string when a escape character is used before the separator. What's the best way to write this? I'm curious about the best non-regex way to approach it....