parsing

How to correctly parse incoming HTTP requests.

Hello all, i've created an C++ application using WinSck, which has a small (handles just a few features which i need) http server implemented. This is used to communicate with the outside world using http requests. It works, but sometimes the requests are not handled correctly, because the parsing fails. Now i'm quite sure that the requ...

extract content from mediawiki api call (xml, curl)

URL: http://en.wikipedia.org/w/api.php?action=parse&amp;prop=text&amp;page=Lost_(TV_series)&amp;format=xml this outputs something like: <api><parse><text xml:space="preserve">text...</text></parse></api> how do i get just the content between <text xml:space="preserve"> and </text>? i used curl to fetch all the content from this ur...

String parsing having Special characters

I have a String in this form: String buf = "[[[name11,name12]][[name21,name22]][[name31,name32]]]"; How can I retrieve all the names? When i retreive data from database i recive it in this form. Looking for Java Solution. Thanks ...

Is there a Python package to parse readable data files with sections

I am looking for a method to parse readable (i.e., not binary) data files with sections. I had been using ConfigObj to read config files (INI files?), but I ran into a problem with multi-line lists. Specifically, ConfigObj does not allow list members to contain carriage returns. In other words, the following fails to parse: [section] d...

Get each line from textarea

<textarea> put returns between paragraphs for linebreak add 2 spaces at end indent code by 4 spaces quote by placing > at start of line </textarea> $text = value from this textarea; How to: 1) Get each line from this textarea ($text) and work with them using foreach()? 2) Add <br /> to the end of each line, except the last one? 3) ...

iwlist scan output format

I have to write a tool to get the encryption type out of a iwlist scan. I just can't seem to find whether or not there's a standard output. Googling it looks like people are posting slightly different formats, but I can't tell if they just copy/pasted wrong or what. Specifically, in Encryption key: On, is On/Off frist letter always capit...

Want to use VTD-XML to extract inner Xml: Guess this is what VTDNav.getContentFragment is for. How does is work?

I am trying to figure out how I could extract an inner Xml String from a Xml document. According to the API there a method VTDNav.getContentFragment() which seems to be the right choice. But this method returns a long. How do I use that long value to retrieve the xml between the two tags? Any help appreciated. Thanks in advance. ...

PHP preg_replace making regex optional?

Hi, I have some content that I am trying to parse... I have html and with in the html I want to replace all my img tags with a custom string. Now one of the problems I have is that some content that comes in: the image tags is between a anchor. ex. <a href="link"><img></a> The following code I have works...but I want it to be option...

JSON Parsing in Android

Hello All! I have searched alot on JSON Parsing in Androi, but couldn't quite convinced. Actually got a brief idea but not so clear yet regarding JSON Parsing. How to implement the JSON Parsing in the Application? Looking for help!!!!! Thanks, david ...

parsing sip using pjsip

Hi all, does any one has experience in using pjsip ? I'm trying to parse SIP message without success. Even the simplest program does not work. Here is the code http://pastebin.com/gVTC3zRw it gives my "Segmentation fault". Please help. I'm trying to make it work for 2 day now... ...

bug of RapidXML when the value of a xml node is null

If the value of node in the xml is null, when we print the xml node, the node has no start tag, but only the end tag. For example: xml_document<char> doc; doc.append_node(doc.allocate_node(rapidxml::node_element, "mynode", "")); ofstream ofs("test.xml"); ofs<<doc; the content of test.xml is: </mynode> the expected content of test.x...

How to differentiate SQL statements that modify data from those that are read only?

I need to write a jdbc compliant driver wrapper whose purpose is to log all SQL statements that modify data. What is the easiest way to differentiate those statements that modify data from those that only read data? I guess that only way is to parse SQL code on the fly, any libraries that can do that? ...

How to identify what state variables are read/written in a given method in C#

What is the simplest way to identify if a given method is reading or writing a member variable or property? I am writing a tool to assist in an RPC system, in which access to remote objects is expensive. Being able to detect if a given object is not used in a method could allow us to avoid serializing its state. Doing it on source code ...

read values from a file

I'm learning C# programming. I try to read for example: patient id or patient name from dicom tags. I tried like that: string tag = ""; string op = ""; string val_rep = ""; string war = ""; if (DicomFile.IsDicomFile(f)) { Sequence se = plik.GetJointDataSets().GetJointSubsequences(); ...

PHP Simple CSS string parser

I need to parse some CSS code like: color: black; font-family:"Courier New"; background:url('test.png'); color: red; --crap; Into: array ( 'color'=>'red', 'font-family'=>'"Courier New"', 'background'=>'url(\'test.png\')', '--crap'=>'' ) I need to do this via PHP. I can see this done easily via regexp (well, easy to...

Problem with LINQ Filters in Telerik RadGrid

Hi all. I have a problem using Telerik RadGrid. When I apply a filter on a data column, I use the filter expression as a Linq expression. So (server side) I parse it with Dynamic Linq (from MIcrosoft LINQ examples) in NeedDataSource handler. The problem is that when I specify "Start With" as a filter, I receive the following as "Linq ex...

html parser in iphone

i want to display output of html file without using uiwebview.please give some sample code to parse html file............thanks in advance ...

Software other than paint to create parsetrees automagic

I have a BNF grammar, and quite a few expressions that I am suppose to parse in regard to the grammar. Does it exists some software that I can enter the trees using ( ) to express the tree and than the software draws them? ...

Get methods, comments and classes from source code in java?

I'd like to somehow create some kind of class that can read a source code file(ie java) and from that extract the method names, the method source-code, the methods description comment and such. Is this possible in any simple way? I'd also like to avoid complicated parsers and such. Is regexp any good for this? Programming language = ja...

What is a good parser generator for php?

I need to parse a small 'mini language' which users can type on my site. I was wondering what the counterparts of lex and jacc or antlr are for the world of php. ...